function login_history_last_login in Login History 6
Same name and namespace in other branches
- 8 login_history.module \login_history_last_login()
- 7 login_history.module \login_history_last_login()
Provide data about the last login for a user.
Parameters
$account Optional user object. The only thing that matters is the uid.:
1 call to login_history_last_login()
- login_history_block in ./
login_history.module - Implements hook_block().
File
- ./
login_history.module, line 105
Code
function login_history_last_login($account = NULL) {
if (user_is_anonymous()) {
return;
}
if (empty($account)) {
global $user;
$account = $user;
}
$last_login = db_query("SELECT login, hostname, one_time, user_agent\n FROM {login_history}\n WHERE uid = %d\n ORDER BY login DESC\n LIMIT 1, 2", array(
$account->uid,
));
return db_fetch_object($last_login);
}