We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11351
    • 16 Posts
    Hi,

    I have created a subdomain context in the manager and have followed all the steps to restrict access to pages but it doesnt seem to work for a subdomain.

    I tried the following but I always get Unauthorised when I try to login

    $ctx = $modx->context->get('key');
    if (!$modx->user->hasSessionContext( array($ctx)));
    $modx->sendUnauthorizedPage();


    Any Thoughts?
      • 22303 MODX Staff
      • 10,725 Posts
      Yeah, that code is wrong; the semi-colon after the if statement is the problem. Try..
      $ctx = $modx->context->get('key');
      if (!$modx->user->hasSessionContext( array($ctx))) {
          $modx->sendUnauthorizedPage();
      }