New field to show the day of the last activity

This commit is contained in:
Michael 2022-11-30 22:34:50 +00:00
parent fbcc56d42d
commit f905220923
8 changed files with 50 additions and 4 deletions

View file

@ -665,6 +665,22 @@ class User
return $user;
}
/**
* Update the day of the last activity of the given user
*
* @param integer $uid
* @return void
*/
public static function updateLastActivity(int $uid)
{
$user = User::getById($uid, ['last-activity']);
$current_day = date('Y-m-d');
if ($user['last-activity'] != $current_day) {
User::update(['last-activity' => $current_day], $uid);
}
}
/**
* Generates a human-readable random password
*