I am using the authenticate function in the UserIdentity component to check a users details in the database. This works fine. In my database table User I have a column called admin (0 = guest 1 = admin). How do I set this in this function, then call it in my scripts to determine if the user has admin privliages (1) or guest privlages (0).
public function authenticate()
{
$user=User::model()->find('LOWER(email)=?',array(strtolower($this->username)));
if($user===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else if(!$user->validatePassword($this->password))
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
{
$this->_id=$user->userId;
$this->username=$user->email;
$this->errorCode=self::ERROR_NONE;
}
return $this->errorCode==self::ERROR_NONE;
}
Hehe, i thought i’ve read this syntax somewhere in the guide - but i guess i was wrong. The only place this way of passing parameters is mentioned seems to be in the API docs for bindParam/bindValue which are used by AR internally. So, that’s why this works, too. Just curious, can you tell where you learned this syntax?