WP Last Login

Description

Make the last login for each user visibile in the user overview.

This plugin adds an extra column to the users overview with the date of the last login for each user.

Translations

I will be more than happy to update the plugin with new locales, as soon as I receive them!
Currently available in:

  • Arabic
  • Chinese
  • Français
  • Deutsch
  • English
  • Español
  • Italiano
  • Japanese
  • Nederlands
  • Polski
  • Portugués
  • Román
  • Russian

Installation

  1. Download WP Last Login.
  2. Unzip the folder into the /wp-content/plugins/ directory.
  3. Activate the plugin through the ‘Plugins’ menu in WordPress.

Frequently Asked Questions

None asked yet.

Screenshots

Screenshot WP Last Login
Last login column in the user table

Changelog

1.1.2

  • Fixed a bug where content of other custom columns were not displayed.

1.1.1

  • Updated utility class

1.1.0

  • Made the display of the column filterable
  • Widened the column a bit to accomodate for large date strings

1.0

  • Initial Release

Plugin Filter Hooks

wpll_date_format (string)
The date format string for the date output.

28 thoughts on “WP Last Login

  1. Hi. Thank you for your plugin. Do you think you could make the users list sortable by the “log in date”?

    THanks.

    Michele

  2. I am getting a conflict with “Recently Registered” plugin: http://wordpress.org/extend/plugins/recently-registered/
    When both are activated, the column for “Recently Registered” is blank. I have notified the developer of that plugin here:
    http://halfelf.org/plugins/recently-registered/#comment-4672
    I’m looking through the code, and I think it’s the way you hook into the code:
    $this->hook( 'manage_users_custom_column' );
    I’m thinking you should rename the function, the same way to do with the other hooks:
    $this->hook( 'manage_users_custom_column', 'wpll_columns' );

    Does that look right?

      • Hey James,

        I’m sorry my plugin is giving you trouble. I’ll have a look asap and get back to you.
        Thank you for your feedback!

        Konstantin

    • I made some progress: the following code works without conflict in my functions.php file:


      // insert the last login date for each user
      function insert_last_login( $login ) {
      global $user_id;
      $user = get_userdatabylogin( $login );
      update_user_meta( $user->ID, 'last_login', gmdate( 'Y-m-d H:i:s' ) );
      }
      add_action( 'wp_login', 'insert_last_login' );
      // add a new "Last Login" user column
      function add_last_login_column( $columns ) {
      $columns['last_login'] = __( 'Last Login', 'last_login' );
      return $columns;
      }
      add_filter( 'manage_users_columns', 'add_last_login_column' );
      // add the "Last Login" user data to the new column
      function add_last_login_column_value( $value, $column_name, $user_id ) {
      $user = get_userdata( $user_id );
      if ( 'last_login' == $column_name && $user->last_login )
      $value = date( 'm/d/Y g:ia', strtotime( $user->last_login ) );
      return $value;
      }
      add_action( 'manage_users_custom_column', 'add_last_login_column_value', 10, 3 );

      I found this on the AppThemes website.

      Cheers!

      • I found the bug, it was a missing return value in one of my callbacks.
        Expect an update later today! 🙂

        Konstantin

  3. Does this only work from the time it is installed or will it show the last login date from before the plugin was installed?

    All my members have Never attributed to them.

    • No, since WordPress does not record the time of the last login. Hence the plugin. 🙂
      So as long as they have not logged in, the ‘Never’ message gets displayed.

      Konstantin

  4. Thank you for the plugin. It looks promising, but it conflicts with the “User Access Manager”.

    Can you please check the issue?

    I have also notified the UAM developer.

    • Hi Levon,

      thank you for your feedback! I contacted Alexander on this issue.

      Funny story, WP Last Login had the same bug. See a couple of comments earlier. 🙂

      Thank you for bringing it up and giving us the chance to improve!
      Konstantin

  5. Hi there,

    Thank you for your nice plugin. Anyway, i want to display last login date in the header area of my website, so if user read my site after their logon, it will be displayed in the header area. Could you tell me how to do that? Thank you.

    • With a function like this:

      function wpll_get_last_login() {
      	if ( is_user_logged_in() AND $last_login = get_user_meta( get_current_user_id(), 'wp-last-login', true ) ) {
      		return date_i18n( get_option('date_format') , $last_login );
      	}
      }
      

      Hope this’ll do it for you!

      Konstantin

  6. thanks for this wonderful plugin. just one question:
    i want to display the date and time ie. 2012-07-02 16PM, can you change the code for me please. thanks

  7. Great plugin! Quick question: Does the plugin start logging times only AFTER you install it? I ask because right after the install, the last login for all users says “Never.”

  8. Hello

    I have updated to the latest version of the plugin, but now the dates are just ‘gobbledegook’. I just get a string of numbers, whereas all was working find before. E.g. my last login to my site, just now, shows as 1366370258. It is similar for other users.

    Any ideas please?

    • Hi Tig,

      Sorry that you ran into issue with the plugin. I haven’t updated it in over a year though, so I’m not sure what you updated it to.
      Have you tried downloading a fresh version of the plugin and overwriting the previous files via FTP?

      Alternatively you could delete the plugin and re-install it, but that would also remove all data.

  9. Hi Konstantin, thanks for the plugin, it’s exactly what I need. Unfortunately it’s not showing any values in the User list in the dashboard. If I look at the DB directly I can see the wp-last-login information is being written to the usermeta table.

    Any ideas why it wont display on the Users page? I am also running UAM, would this cause a conflict (see it mentioned above).

    Thanks
    Shay

    • Hi Shay,

      yes, most likely. I contacted Alexander again, I hope with better luck this time.

  10. For what it’s worth, I was also getting a numerical string in the “last login” column. I am also running the WP-Members plugin. When I deactivated WP-Members plugin, Last Login reported the last login date correctly. So, some kind of conflict between those two plugins.

    • I reached out to the developer, thank you for letting me know about it and giving us the chance to improve our plugins!

  11. I was wondering if you would consider adding an option to automatically delete users who haven’t logged in for a certain number of days and have a certain role (ex. subcriber with more than 60 days without login). This could be added as a daily one-time cron job to make it easier for the admin to cut down on inactive users. If that would help, I would gladly contribute with a donation for your time.

    • Hey Czompo,

      This really goes far beyond what this plugin intends to do and sounds more like an idea for a new plugin to me. I prefer having plugins for a single functionality and not be too broad and adding a bunch of functionality the majority of users would likely not need (except Jetpack 😉 ). Having said that, I do think it would make sense to create a plugin that would do exactly what you described!

  12. Howdy,

    I decided to close comments here and link to the plugin’s support forum instead. I hope this will give everyone a better chance to receive an answer to their question in a reasonable time as I’m not always able to react to comments right away.

    Thanks!

Comments are closed.