/** * * @param vB_Session $session */ public static function setCurrentSession(vB_Session $session) { if (self::$currentSession !== null) { //if we are changing to a new user, let's reload the permissions. It may be slower, but it should //be safer and shouldn't be that common. unset(self::$usercontexts[$session->get('userid')]); } self::$currentSession =& $session; // this should be the ONLY way of setting $vbulletin->session and $vbulletin->userinfo attributes // old code may set attributes inside session and userinfo, but as we have references the session object should be updated as well $vbulletin =& self::get_registry(); $vbulletin->session =& $session; $vbulletin->userinfo =& $session->fetch_userinfo(); }