We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 14883 ☆ A M B ☆
    • 450 Posts
    I'm working with a login page that logs the user in to two contexts - the 'web' context and a 'secure' context. I have a snippet that runs $modx->runProcessor('security/login'), with the contexts passed as arguments, that does the login.

    I have a logout page on my 'secure' context. Currently it is running the Login snippet to log the user out, with &service=logout. However this is only logging the user out of the 'secure' context - they are still logged in to the 'web' context. I tried adding '&contexts=`web,secure` to the Login snippet call, but this doesn't help. (the documentation says "Experimental").

    How would I log the user out of ALL contexts I want to log them out of? I know there is a processor 'security/logout', but I have no idea how to use it. (My login code was written by someone with more knowledge than I have.)

      • 14883 ☆ A M B ☆
      • 450 Posts
      I found the answer.

      $c = array(
      	  		'login_context' => $modx->context->get('key'),
      			'add_contexts' => 'web,secure'
      	     );
      $result = $modx->runProcessor('security/logout',$c);