public function restoreSession($user_id = null)
    {
        if (empty($user_id)) {
            $user_id = activeUser('id');
        }

        if (empty($user_id)) {
            $this->setError('Must specify which user ID\'s session to restore.');
            return false;
        }

        $oUser = $this->oUserModel->getById($user_id);

        if (!$oUser) {
            $this->setError('Invalid User ID');
            return false;
        }

        // --------------------------------------------------------------------------

        //  Clean slate
        $this->oHybridAuth->logoutAllProviders();

        // --------------------------------------------------------------------------

        $this->oDb->where('user_id', $oUser->id);
        $aSessions = $this->oDb->get(NAILS_DB_PREFIX . 'user_social')->result();
        $aRestore  = [];

        foreach ($aSessions as $oSession) {
            $oSession->session_data = unserialize($oSession->session_data);
            $aRestore               = array_merge($aRestore, $oSession->session_data);
        }

        return $this->oHybridAuth->restoreSessionData(serialize($aRestore));
    }
public function restoreSession($user_id = null)
    {
        if (empty($user_id)) {
            $user_id = activeUser('id');
        }

        if (empty($user_id)) {
            $this->setError('Must specify which user ID\'s session to restore.');
            return false;
        }

        $oUser = $this->oUserModel->getById($user_id);

        if (!$oUser) {
            $this->setError('Invalid User ID');
            return false;
        }

        // --------------------------------------------------------------------------

        //  Clean slate
        $this->oHybridAuth->logoutAllProviders();

        // --------------------------------------------------------------------------

        $this->oDb->where('user_id', $oUser->id);
        $aSessions = $this->oDb->get(NAILS_DB_PREFIX . 'user_social')->result();
        $aRestore  = [];

        foreach ($aSessions as $oSession) {
            $oSession->session_data = unserialize($oSession->session_data);
            $aRestore               = array_merge($aRestore, $oSession->session_data);
        }

        return $this->oHybridAuth->restoreSessionData(serialize($aRestore));
    }
public function restoreSession ( $ user_id = null ) { if ( empty ( $ user_id ) ) { $ user_id = activeUser ( 'id' ) ; } if ( empty ( $ user_id ) ) { $ this -> setError ( 'Must specify which user ID\'s session to restore.' ) ; return false ; } $ oUser = $ this -> oUserModel -> getById ( $ user_id ) ; if ( ! $ oUser ) { $ this -> setError ( 'Invalid User ID' ) ; return false ; } // -------------------------------------------------------------------------- //  Clean slate $ this -> oHybridAuth -> logoutAllProviders ( ) ; // -------------------------------------------------------------------------- $ this -> oDb -> where ( 'user_id' , $ oUser -> id ) ; $ aSessions = $ this -> oDb -> get ( NAILS_DB_PREFIX . 'user_social' ) -> result ( ) ; $ aRestore = [ ] ; foreach ( $ aSessions as $ oSession ) { $ oSession -> session_data = unserialize ( $ oSession -> session_data ) ; $ aRestore = array_merge ( $ aRestore , $ oSession -> session_data ) ; } return $ this -> oHybridAuth -> restoreSessionData ( serialize ( $ aRestore ) ) ; }
Restores a user's social session

@param  mixed $user_id The User's ID (if null, then the active user ID is used)

@return boolean
Restores a user s social session