hi i m trying to update the value of the Last_visited in the user table i m currently using this in the site controller
private function lastActive(){
$user_model = User::model()->findByPk(Yii::app()->user->id);
$user_model->last_active = date('Y-m-d H:i:s');
if($user_model->save()){
print_r($user_model->last_active);
}else{
echo 'hello it is not working';
}
actually when the model was being saved it required some more attributes which were defined required in the rules so now i m using this to accomplish the issue in the loginForm Model’s login function
if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
{
$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($this->_identity,$duration);
User::model()->updateByPk($this->_identity->id,array('last_active'=> new CDbExpression('NOW()')));
return true;
}