Example #1
0
 /**
  * Sign In the user.
  * 
  * Also sign in user on the PunBB forum, by way of the forum cookie.
  * The "remember me" option applies similarly to the forum cookie.
  * 
  * @param  array  $user  UsersPeer row
  * @return 
  */
 public function signIn($user)
 {
     $this->setAttribute('userid', $user['userid']);
     $this->setAttribute('username', $user['username']);
     $this->setAttribute('usertimezone', $user['timezone']);
     $this->clearCredentials();
     $this->addCredential('member');
     switch ($user['userlevel']) {
         case UsersPeer::USERLEVEL_ADMIN:
             $this->addCredential('admin');
             break;
         default:
             break;
     }
     // authenticate the user
     $this->setAuthenticated(true);
     // update user's last login timestamp
     UsersPeer::setLastlogin($user['userid']);
 }