On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Since I really needed this, I went on and patched the document.parser.(line 1623) to get this behaviour, as described in the wiki.
    Note that if you call this on the frontend when logged in both as web and manager users, only the web user info will be returned.

        function userLoggedIn() {
            $webVal = isset($_SESSION['webValidated']);
            $mgrVal = isset($_SESSION['mgrValidated']);
            if ($this->isFrontend()){
    		//on frontend
            	if ($webVal){
             	//webuser is logged in
             		$auth = true;
             		$type = 'web';
             		$prefix = 'web';
            	} elseif ($mgrVal){
            	//manager is logged in
            		$auth = true;
            		$type = 'manager';
            		$prefix = 'mgr';
            	} else {
            	//neither is logged in
            		$auth = false;
            } elseif ($this->isBackend() && $mgrVal){
    		//inside manager and authenticated
    			$auth = true;
    			$type = 'manager';
        		$prefix = 'mgr';
            } else {
    		//if all else fails...
            	$auth = false;
            if ($auth){
    		//if some user logged in...
    			$userdetails= array (
    				'loggedIn' => true,
    				'id' => $_SESSION[$prefix.'InternalKey'],
    				'username' => $_SESSION[$prefix.'Shortname'],
    				'usertype' => $type // added by Raymond
                return $userdetails;
            	return false;

    Reported this on Flyspray and the wiki
      Got Music? Try XSPFjukebox - Skinnable MODx Media Player
    • Nevermind -- I was completely wrong in my initial posts. Sorry everybody! I’ll just wait to discuss those changes...

      What really needs to happen is a parameter needs to be added, in accordance with the recent changes to DocumentParser :: getLoginUserID($context) and a few other methods. A context string is added which indicates specifically (’web’ or ’mgr’) which user information you want, and if empty, your logic to get the web context or the mgr context is right on. This will help forward compatibility with 0.9.7.