Model_Auth_User::complete_login PHP Method

complete_login() public method

Complete the login for a user by incrementing the logins and saving login timestamp
public complete_login ( ) : void
return void
    public function complete_login()
    {
        if (!$this->_loaded) {
            // nothing to do
            return;
        }
        // Update the number of logins
        $this->logins = new Database_Expression('logins + 1');
        // Set the last login date
        $this->last_login = time();
        // Save the user
        $this->save();
    }

Usage Example

Example #1
0
 public function force_login($user, $mark_session_as_forced = false)
 {
     if (!is_object($user)) {
         $username = $user;
         $user = ORM::factory('user');
         $user->where($user->unique_key($username), '=', $username)->find();
     }
     if ($mark_session_as_forced === true) {
         Session::instance()->set('auth_forced', $user->username);
     }
     return parent::complete_login($user);
 }
All Usage Examples Of Model_Auth_User::complete_login