<![CDATA[ $modx->user not available in other contexts? - MODX Community Forums]]> https://forums.modx.com/thread/?thread=30509 <![CDATA[Re: $modx->user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-554020 ]]> BobRay Sep 20, 2017, 08:55 PM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-554020 <![CDATA[Re: $modx->user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-554005 ]]> stefan79w Sep 20, 2017, 08:34 AM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-554005 <![CDATA[Re: $modx->user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-553995

$modx->switchContext('web-ja', true);

The second argument tells MODX to reload the context.]]>
BobRay Sep 19, 2017, 08:24 PM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-553995
<![CDATA[Re: $modx->user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-553984
Had the same Problem (but one domain instead of different Domains). Login for default context works fine. The second not:

  • Nothing happened after Login
  • Backend says user is logged in
  • for example [[+modx.user.id]] stays empty


  • 2 Contexts with Babel
  • gateway to switch contexts
  • Login extra

Solution which works fine (but only after i made all the 3 changes and cleared the cache via ftp)

  • Add 2 lines of code at the gateway to initialize BOTH contexts (see code at the bottom)
  • Change System Setting: session_cookie_domain: myDomain.de || session_cookie_path: /
  • Add Parameter &contexts=`web-ja,web` to [[!Login]] call

// 2 lines of code to initialize the contexts

if($modx->context->get('key') != "mgr"){
    /* grab the current langauge from the cultureKey request var */
    switch ($_REQUEST['cultureKey']) {
        case 'de':
            /* switch the context */
        case 'ja':
            /* switch the context */
            /* Set the default context here */
    /* unset GET var to avoid
     * appending cultureKey=xy to URLs by other components */

login call

stefan79w Sep 19, 2017, 09:28 AM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-553984
<![CDATA[Re: $modx-&gt;user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165354
&context option should be added to rtfm .. and also system setting session_cookie_domain could be in settings with some null value .. in that way i could see it smiley]]>
theuros May 12, 2011, 03:12 PM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165354
<![CDATA[Re: $modx-&gt;user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165353 Wheer is this option, how i can use it ?? .. i didn’t see it in docs ? can this cause my problem ?
It’s just called "contexts" and it’s used like so:

[[!Login? ... &contexts=`web,italian`]]
swespi May 12, 2011, 01:57 PM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165353
<![CDATA[Re: $modx-&gt;user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165352 opengeek May 12, 2011, 10:55 AM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165352 <![CDATA[Re: $modx-&gt;user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165351
-i have 4 contexts: web,english,slovenian and italian
-i created 3 user groups users_en, users_si, users_it
-i have three domains, each domain for each context (without web context)

i use login addon to register new user in specific user group .. but i have problems with login

i registered a user on italian domain, so it went to "users_it" group. On "users_it" group i set the context access as "Load Only" with minimun role "Member - 9999" for context "italian"

with my user i can login on web context .. but i can’t login on italian domain useing italian context .. i can login only on web ... i missed something ?? what i have to do so the users from users_it will be abble to login only on italian domain using italian context ?? .. and EN users for english domain and SI users for slovenian domain?

Quote from: OpenGeek at Mar 04, 2011, 12:07 AM

...The Login snippet has options for this.
Wheer is this option, how i can use it ?? .. i didn’t see it in docs ? can this cause my problem ?

theuros May 12, 2011, 02:57 AM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165351
<![CDATA[Re: $modx-&gt;user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165350 opengeek Mar 03, 2011, 06:07 PM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165350 <![CDATA[Re: $modx-&gt;user not available in other contexts?]]> https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165349 I have a very similar situation.
Login works properly from main domain(site.com) and a [[checksession? &context=`web]] and [[checksession? &context=`other`]] both result in true as well as access to the user object [[+modx.user.username]]

But when same login snippet is added to other subdomain (sub.site.com) the login snippet (although it does redirect to &loginResponse=`1`) results in a false checksession and no user object returned.

I have tried adding the .site.com to system setting session_cookie_domain but I don’t see any real change.

scott_gb Mar 03, 2011, 10:00 AM https://forums.modx.com/thread/30509/modx--user-not-available-in-other-contexts?page=2#dis-post-165349