Difference between #6 and #7 of
How to add more information to Yii::app()->user

Revision #7 has been created by Maurizio Domba Cerin on Feb 7, 2012, 11:43:36 AM with the memo:

removed Yii 1.0.2 note
« previous (#6) next (#8) »

Changes

Title unchanged

How to add more information to Yii::app()->user

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

CWebUser, authentication

Content changed

[...]
```php
$id=Yii::app()->user->id;
$lastLoginTime=Yii::app()->user->lastLoginTime;
// If you are using version 1.0.2 or earlier, you should use the following:
 
// $lastLoginTime=Yii::app()->user->getState('lastLoginTime');
 
```

> Note: When cookie-based authentication is enabled (by setting [CWebUser::allowAutoLogin] to be true), these persistent information will be stored in cookie. Therefore, you should NOT store sensitive information (e.g. password) like we do in the above.

**Related article**
The method explained above stores the user data into session or cookies when the user authenticates, there is another method of retrieveing user information from database directly:
[...]
21 0
28 followers
Viewed: 184 764 times
Version: 1.1
Category: Tutorials
Written by: qiang
Last updated by: Yang He
Created on: Feb 9, 2009
Last updated: 5 years ago
Update Article

Revisions

View all history