Leave a Reply

1 comment

  1. I don’t see anything like it in the database, so you probably have to do this yourself. To save the last login time, you can hook into the wp_login action, and save a user meta value (like [myprefix]_lastlogintime). You first read this value, so you get the previous login time, save this in the session, and then save the new login time.

    On the regular admin pages you check whether this session variable is set. If it is, you display the welcome text and clear the session variable so you don’t display it on every page.

    If you want to save the last page visit time you have to write to the database on every (admin) page view. This is possible, but I would not recommend it. You can also save something once on logout (action wp_logout), but probably not everyone will remember to log out.