Changeset 2117865
- Timestamp:
- 07/05/2019 05:51:02 AM (7 years ago)
- Location:
- wp-force-logout/trunk
- Files:
-
- 4 edited
-
includes/class-wp-force-logout-process.php (modified) (4 diffs)
-
includes/class-wp-force-logout.php (modified) (1 diff)
-
readme.txt (modified) (4 diffs)
-
wp-force-logout.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-force-logout/trunk/includes/class-wp-force-logout-process.php
r2070470 r2117865 18 18 add_filter( 'manage_users_columns', array( $this, 'add_column_title' ) ); 19 19 add_filter( 'manage_users_custom_column', array( $this, 'add_column_value' ), 10, 3 ); 20 add_filter( 'manage_users_sortable_columns', array( $this, 'sortable_login_activity' ) ); 21 add_filter( 'users_list_table_query_args', array( $this, 'sortby_login_activity' ) ); 20 22 add_action( 'init', array( $this, 'update_online_users_status' ) ); 21 23 add_action( 'init', array( $this, 'update_last_login' ) ); 24 add_action( 'load-users.php', array( $this, 'add_last_login' ) ); 22 25 add_action( 'load-users.php', array( $this, 'trigger_query_actions' ) ); 23 26 add_action( 'load-users.php', array( $this, 'trigger_bulk_actions' ) ); … … 129 132 130 133 /** 134 * Make login activity column sortable 135 * 136 * @param array $columns Sortable columns. 137 * @since 1.2.2 138 * 139 * @return array 140 */ 141 public function sortable_login_activity( $columns ) { 142 $columns['wpfl'] = 'wpfl'; 143 144 return $columns; 145 } 146 147 /** 148 * 149 * Sort users by login activity. 150 * 151 * @param array $args. 152 * @since 1.2.2 153 * 154 * @return array 155 */ 156 public function sortby_login_activity( $args ) { 157 158 if ( isset( $args['orderby'] ) && 'wpfl' == $args['orderby'] ) { 159 160 $order = isset( $args['order'] ) && $args['order'] === 'asc' ? 'desc' : 'asc'; // Wierd way of reversing the order. Still works. 161 162 $args = array_merge( $args, array( 163 'meta_key' => 'last_login', 164 'orderby' => 'meta_value', 165 'order' => $order, 166 'fields' => 'all', 167 ) ); 168 } 169 170 $users = get_users( $args ); 171 172 return $args; 173 } 174 175 /** 131 176 * Checks if the current user is online or not. 132 177 * @param int $user_id User ID. … … 184 229 185 230 /** 231 * Add last_login meta key for all users with a random number to later compare. 232 * 233 * @todo :: this might gets slower for sites with large number of users. 234 * @since 1.2.2 235 * 236 * @return void. 237 */ 238 public function add_last_login() { 239 $users = get_users(); 240 foreach( $users as $user ) { 241 $last_login = get_user_meta( $user->ID, 'last_login', true ); 242 if( empty( $last_login ) ) { 243 update_user_meta( $user->ID, 'last_login', 0.00058373 ); // Store random number to identify. 244 } 245 } 246 } 247 248 /** 186 249 * Get last login time. 187 250 * … … 194 257 $the_login_date = ''; 195 258 196 if( ! empty( $last_login ) ) {259 if( ! empty( $last_login ) && 0.00058373 != $last_login ) { // Also check against the random number. 197 260 $the_login_date = human_time_diff( $last_login ); 198 261 } -
wp-force-logout/trunk/includes/class-wp-force-logout.php
r2070470 r2117865 17 17 * @var string 18 18 */ 19 public $version = '1.2. 1';19 public $version = '1.2.2'; 20 20 21 21 -
wp-force-logout/trunk/readme.txt
r2070470 r2117865 1 1 === WPForce Logout === 2 2 Contributors: sanzeeb3 3 Tags: logout, force, online, last seen 3 Tags: logout, force, online, last seen, last login 4 4 Requires at least: 4.0 5 5 Tested up to: 5.0 6 6 Requires PHP: 5.3 7 Stable tag: 1.2. 17 Stable tag: 1.2.2 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 17 17 If you need to work on your WordPress website without any users being logged in, you can force all user accounts to be logged out. If you suspect that your WordPress site is hacked, then forcing logout will allow you to properly clean up your hacked WordPress site. Next, if you are using a membership or pay per view site and fear that users may be sharing their passwords to access content, then this plugin will come in handy. Furthermore, you can view the online/offline users from users tab at a glance. 18 18 19 See who's online, last login activity right from the users tab. No need of any settings. Install and activate the plugin, go to users tab and view user's activity. 19 20 20 [Installation And Documentation](https://wpmissing.com/plugins/force-logout-wpforce/)21 21 22 22 [Contact The Author](http://www.sanjeebaryal.com.np) … … 30 30 * Logout Specific User(s) 31 31 * Bulk Logout Users 32 * Users Online/Offline Status Display32 * See who's online 33 33 * Last Login Activity 34 34 * Well Documented … … 55 55 == Changelog == 56 56 57 = 1.2.2 - 07/05/2019 = 58 * Feature - Sortby login activity. 59 57 60 = 1.2.1 - 04/18/2019 = 58 61 * Fix - Login activity for all timestamps. -
wp-force-logout/trunk/wp-force-logout.php
r2070470 r2117865 3 3 * Plugin Name: WPForce Logout 4 4 * Description: Forcefully logout WordPress user(s). 5 * Version: 1.2. 15 * Version: 1.2.2 6 6 * Author: Sanjeev Aryal 7 7 * Author URI: http://www.sanjeebaryal.com.np
Note: See TracChangeset
for help on using the changeset viewer.