Hello, please help, I use Login to login user on frontend multilaguage site.
And I may use Login:
[[!Login?
&redirectToOnFailedAuth=`[[BabelTranslation? &resourceId=`22` &contextKey=`[[context]]`]]`
&contexts=`de,web`
]]
and snippet "context":
$targetstring = $_SERVER["REQUEST_URI"];
if(stristr($targetstring, "/shop/") == TRUE)
return $_SESSION['cntxt'];
return $modx->context->key;
I may probe this on the cache:
[[!Login?
&redirectToOnFailedAuth=`[[!BabelTranslation? &resourceId=`22` &contextKey=`[[context]]`]]`
&contexts=`de,web`
]]
And
[[!Login?
&redirectToOnFailedAuth=`[[!BabelTranslation? &resourceId=`22` &contextKey=`[[!context]]`]]`
&contexts=`web,de`
]]
But: always redirectToOnFailedAuth in first context "web"
and carrefull work this url, no questions:
[[~[[!BabelTranslation? &resourceId=`22` &contextKey=`[[!context]]`]]]]
And, I try this:
if(stristr($targetstring, "/shop/") == TRUE)
$keych = $_SESSION['cntxt'];
else
$keych = $modx->context->key;
switch ($keych) {
case "web":
$out = $modx->runSnippet('Login', array( 'redirectToOnFailedAuth'=> '22' ));
break;
case "de":
$out = $modx->runSnippet('Login', array( 'redirectToOnFailedAuth'=> '67' ));
break;
}
return $out;
But return only first for web: $out = $modx->runSnippet('Login', array( 'redirectToOnFailedAuth'=> '22' ));
And, I try create box parametries across default for snippet "Login": "us" and "web"
and this:
[[!context:isequalto=`us`:then=`
[[!Login@us]]
`]]
[[!context:isequalto=`web`:then=`
[[!Login@web]]
`]]
And return only FIRST -
, if I try this:
[[!context:isequalto=`web`:then=`
[[!Login@web]]
`]]
[[!context:isequalto=`us`:then=`
[[!Login@us]]
`]]
I'm return this
please, correct me!