We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45766
    • 78 Posts
    Solution for your Problem?

    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

    Setup

    • 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

    gateway
    <?php
    // 2 lines of code to initialize the contexts
    $modx->initialize('web');
    $modx->initialize('web-ja');
    
    if($modx->context->get('key') != "mgr"){
        /* grab the current langauge from the cultureKey request var */
        switch ($_REQUEST['cultureKey']) {
            case 'de':
                /* switch the context */
                $modx->switchContext('web');
                break;
            case 'ja':
                /* switch the context */
                $modx->switchContext('web-ja');
                break;
           	default:
                /* Set the default context here */
                $modx->switchContext('web');
                break;
        }
        /* unset GET var to avoid
         * appending cultureKey=xy to URLs by other components */
        unset($_GET['cultureKey']);
    }
    


    login call
    
    [[!Login?
      &loginTpl=`lgnLoginTpl`
      &logoutTpl=`lgnLogoutTpl`
      &errTpl=`lgnErrTpl`
      &loginResourceId=`[[++login_memberPage]]`
      &logoutResourceId=`[[*id]]`
      &contexts=`web-ja,web`
    ]]