-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Core] Add getLastLogin helper to user class #5899
Conversation
This moves the query to get the last user login from the dashboard code to the User class, where it more accurately belongs. (This was extracted from aces#5896 where it was necessary because multiple modules use the last login time to determine if something is new.)
AND userID=:UserID AND Success='Y'", | ||
array('UserID' => $userID) | ||
); | ||
$last_login = $user->getLastLogin($DB)->format('Y-m-d H:i:s'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this cause an error to the effect of "Can't use function 'format' on null" when the function returns null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch. I added a hack to handle null and ensure that it's in the same format as the DB was returning for this PR only if it's set, but I'll fix it properly in the modularized widgets PR because work on this one will end up getting lost in the end anyways
@@ -532,5 +532,32 @@ class User extends UserPermissions | |||
(string) $this->userInfo['Password_hash'] | |||
); | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good pending Travis. I have a suspicion that one of the static analysis tools won't like the two new lines here but maybe it doesn't matter.
One down, 4 to go.. |
This moves the query to get the last user login from the
dashboard code to the User class, where it more accurately
belongs.
(This was extracted from #5896 where it was necessary because
multiple modules use the last login time to determine if something
is new.)