ID; } elseif ( is_string( $user_login ) && '' !== $user_login ) { $by = get_user_by( 'login', $user_login ); if ( $by instanceof WP_User ) { $user_id = (int) $by->ID; } } if ( $user_id <= 0 ) { return; } update_user_meta( $user_id, DESKTOP_MODE_LAST_LOGIN_META_KEY, time() ); /** * Fires after the last-login meta has been written. Lets plugins * piggy-back on the same hook to update their own last-seen * tracking without duplicating the `wp_login` listener. * * @since 0.18.0 * * @param int $user_id User id whose login was recorded. * @param int $timestamp Unix timestamp written. */ do_action( 'desktop_mode_users_window_login_recorded', $user_id, time() ); } add_action( 'wp_login', 'desktop_mode_users_window_record_login', 10, 2 );