Skip to content

Commit

Permalink
Donot add last_login for all users, temp fix #14
Browse files Browse the repository at this point in the history
  • Loading branch information
sanzeeb3 committed Jan 29, 2020
1 parent f4bdab8 commit e7d0734
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions includes/class-wp-force-logout-process.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct() {
add_filter( 'users_list_table_query_args', array( $this, 'sortby_login_activity' ) );
add_action( 'init', array( $this, 'update_online_users_status' ) );
add_action( 'init', array( $this, 'update_last_login' ) );
add_action( 'load-users.php', array( $this, 'add_last_login' ) );
// add_action( 'load-users.php', array( $this, 'add_last_login' ) );
add_action( 'load-users.php', array( $this, 'trigger_query_actions' ) );
add_action( 'load-users.php', array( $this, 'trigger_bulk_actions' ) );
add_filter( 'bulk_actions-users', array( $this, 'add_bulk_action' ) );
Expand All @@ -55,7 +55,7 @@ public function enqueue_scripts() {

wp_enqueue_style( 'wp-force-logout', plugins_url( 'assets/css/wp-force-logout.min.css', WP_FORCE_LOGOUT_PLUGIN_FILE ), array(), WPFL_VERSION, $media = 'all' );

wp_enqueue_script( 'wp-force-logout-js', plugins_url( 'assets/js/admin/wp-force-logout'. $suffix .'.js', WP_FORCE_LOGOUT_PLUGIN_FILE ), array(), WPFL_VERSION, false );
wp_enqueue_script( 'wp-force-logout-js', plugins_url( 'assets/js/admin/wp-force-logout' . $suffix . '.js', WP_FORCE_LOGOUT_PLUGIN_FILE ), array(), WPFL_VERSION, false );
wp_enqueue_script( 'sweetalert', plugins_url( 'assets/js/admin/sweetalert.min.js', WP_FORCE_LOGOUT_PLUGIN_FILE ), array(), WPFL_VERSION, false );
wp_localize_script(
'wp-force-logout-js',
Expand Down Expand Up @@ -177,6 +177,7 @@ public function sortable_login_activity( $columns ) {
* Sort users by login activity.
*
* @param array $args.
*
* @since 1.2.2
*
* @return array
Expand Down Expand Up @@ -263,6 +264,7 @@ public function update_last_login() {
* Add last_login meta key for all users with a random number to later compare.
*
* @todo :: this might gets slower for sites with large number of users.
*
* @since 1.2.2
*
* @return void.
Expand All @@ -288,7 +290,7 @@ public function get_last_login( $user_id ) {
$last_login = get_user_meta( $user_id, 'last_login', true );
$the_login_date = '';

if ( ! empty( $last_login ) && 0.00058373 != $last_login ) { // Also check against the random number.
if ( ! empty( $last_login ) ) {
$the_login_date = human_time_diff( $last_login );
}

Expand Down

0 comments on commit e7d0734

Please sign in to comment.