• wplovin

    (@wplovin)


    Hey,

    Working on a project, where admin wants to see when the user was last logged in.

    Although, I’ve noticed an issue – column always show time in UTC+0 (not taking the fact that I’ve set my timezone to GMT+2 in WordPress settings).

    Fixed this on my own, so just thought you might also be interested in this one.

    The issue is in:

    public function wp_login( $user_login ) {
    		$user = get_user_by( 'login', $user_login );
    		update_user_meta( $user->ID, $this->textdomain, time() );
    	}

    While saving time, your plugin uses time() function, so I propose you to change it to current_time( 'timestamp' ) – that will fix the issue and time will be displayed in correct timezone (set in general settings).

    Tom

    https://wordpress.org/plugins/wp-last-login/

  • The topic ‘Minor tweak to use local time, instead of UTC’ is closed to new replies.