Yii Framework Forum: Update Last Login Date Without Updated Modified Date - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Update Last Login Date Without Updated Modified Date Rate Topic: -----

#1 User is offline   nozomi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 22-September 12

Posted 23 March 2013 - 11:52 AM

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?
0

#2 User is offline   JFReyes 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 503
  • Joined: 28-October 09
  • Location:Puerto Rico

Posted 24 March 2013 - 08:47 AM

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.
José
0

#3 User is offline   mrk 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 33
  • Joined: 07-March 11

Posted 24 March 2013 - 12:31 PM

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".
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users