Last active
August 10, 2016 10:17
-
-
Save jamband/1426248 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class WebUser extends CWebUser | |
{ | |
protected function afterLogin($fromCookie) | |
{ | |
$model = User::model()->findByPk(Yii::app()->user->id); | |
$model->last_ip = Yii::app()->request->userHostAddress; | |
$model->last_login = new CDbExpression('NOW()'); | |
$model->save(true, array('last_ip', 'last_login')); | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment