Update Last Login Date Without Updated Modified Date

I have my user model set to update two dates. If it’s a new record it updates the created date and modified if it’s an update.

What if I want to handle a last login update when a user logs in? Is there a way to do so without it triggering the the modified field? I was thinking perhaps checking to see if the old login has changed or not, but I’ve been able to get the old value for comparison.

Any ideas or pointers?

Set updateAttribute to NULL in CTimeStampBehavior before saving the logon information, and after saving it reset it to ‘update_time’ or whatever name you use.

Or you can use scenarios. I guess you have this update_time assignment on the side of Yii, right? If yes then it’s very easy to get this behaviour of updating update_time only when current model have scenario equal to for example “update” but not when scenario is “login”.