Panel Login: Log Timestamps

Is there already an easy way to log at least the last login date from users in the panel or even better from users, that login in the frontend?

For users that log in via the frontend, you could update a user field in your login field before you redirect the user.

For users that log in via the Panel login form, there is no login hook, so that would only be possible with a custom login view. There is an ideas issue though for a login hook.

Okay, thank you for this information!

Here is the issue if you want to upvote:

We expect it to be released in the next version of 3.3.0

2 Likes

To log the last login date via frontend a possible config.php entry looks like this:

'hooks' => [
    'user.login:after' => function ($user, $session) {
        $user->update([
          'LastLogin' => date("m.d.Y")
        ]);
    }
 ],
2 Likes