public function logout()
    {
        $oUserModel = Factory::model('User', 'nails/module-auth');
        $oUserModel->clearRememberCookie();

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

        //  null the remember_code so that auto-logins stop
        $oDb = Factory::service('Database');
        $oDb->set('remember_code', null);
        $oDb->where('id', activeUser('id'));
        $oDb->update(NAILS_DB_PREFIX . 'user');

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

        //  Destroy key parts of the session (enough for user_model to report user as logged out)
        $oUserModel->clearLoginData();

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

        //  Destroy CI session
        $oSession = Factory::service('Session', 'nails/module-auth');
        $oSession->destroy();

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

        //  Destroy PHP session if it exists
        if (session_id()) {
            session_destroy();
        }

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

        return true;
    }
public function logout()
    {
        $oUserModel = Factory::model('User', 'nails/module-auth');
        $oUserModel->clearRememberCookie();

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

        //  null the remember_code so that auto-logins stop
        $oDb = Factory::service('Database');
        $oDb->set('remember_code', null);
        $oDb->where('id', activeUser('id'));
        $oDb->update(NAILS_DB_PREFIX . 'user');

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

        //  Destroy key parts of the session (enough for user_model to report user as logged out)
        $oUserModel->clearLoginData();

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

        //  Destroy CI session
        $oSession = Factory::service('Session', 'nails/module-auth');
        $oSession->destroy();

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

        //  Destroy PHP session if it exists
        if (session_id()) {
            session_destroy();
        }

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

        return true;
    }
public function logout ( ) { $ oUserModel = Factory :: model ( 'User' , 'nails/module-auth' ) ; $ oUserModel -> clearRememberCookie ( ) ; // -------------------------------------------------------------------------- //  null the remember_code so that auto-logins stop $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> set ( 'remember_code' , null ) ; $ oDb -> where ( 'id' , activeUser ( 'id' ) ) ; $ oDb -> update ( NAILS_DB_PREFIX . 'user' ) ; // -------------------------------------------------------------------------- //  Destroy key parts of the session (enough for user_model to report user as logged out) $ oUserModel -> clearLoginData ( ) ; // -------------------------------------------------------------------------- //  Destroy CI session $ oSession = Factory :: service ( 'Session' , 'nails/module-auth' ) ; $ oSession -> destroy ( ) ; // -------------------------------------------------------------------------- //  Destroy PHP session if it exists if ( session_id ( ) ) { session_destroy ( ) ; } // -------------------------------------------------------------------------- return true ; }
Log a user out

@return boolean
Log a user out