i made this code with a tutorial:
class UserIdentity extends CUserIdentity
{
private $_id;
private $_email;
public function authenticate()
{
$user=User::model()->findByAttributes(array('username'=>$this->username));
if($user===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else if($user->password!==md5($this->password))
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
{
$this->_id=$user->id;
$this->_email=$user->email;
$this->errorCode=self::ERROR_NONE;
}
return !$this->errorCode;
}
public function getId()
{
return $this->_id;
}
}
And i try to save that ID of the user, but it does not return the ID, it returns the emailadres, and the email is not defined when calling it like:
echo Yii::app()->user->email;
Please help me! Im new to Yii!