Changeset 2959610
- Timestamp:
- 08/28/2023 10:44:51 PM (3 years ago)
- Location:
- lock-user-account
- Files:
-
- 16 added
- 3 edited
-
tags/1.0.4 (added)
-
tags/1.0.4/assets (added)
-
tags/1.0.4/assets/banner-1544x500-rtl.png (added)
-
tags/1.0.4/assets/banner-772x250-rtl.png (added)
-
tags/1.0.4/assets/icon-128x128.png (added)
-
tags/1.0.4/assets/screenshot-1.png (added)
-
tags/1.0.4/assets/screenshot-2.png (added)
-
tags/1.0.4/assets/screenshot-3.png (added)
-
tags/1.0.4/assets/screenshot-4.png (added)
-
tags/1.0.4/includes (added)
-
tags/1.0.4/includes/class-settings-field.php (added)
-
tags/1.0.4/includes/class-user-meta.php (added)
-
tags/1.0.4/index.php (added)
-
tags/1.0.4/languages (added)
-
tags/1.0.4/lock-user-account.php (added)
-
tags/1.0.4/readme.txt (added)
-
trunk/includes/class-user-meta.php (modified) (3 diffs)
-
trunk/lock-user-account.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lock-user-account/trunk/includes/class-user-meta.php
r2410754 r2959610 25 25 add_filter( 'manage_users_custom_column', array( $this, 'output_column' ), 10, 3 ); 26 26 27 // Add filterto process bulk action request28 add_ filter( 'handle_bulk_actions-users', array( $this, 'process_lock_action' ), 10, 3);27 // Add action to process bulk action request 28 add_action( 'admin_init', array( $this, 'process_lock_action' ) ); 29 29 } 30 30 … … 33 33 * 34 34 * @param array $actions Array of users bulk actions 35 * @return array Array with ad ition of Lock action35 * @return array Array with addition of Lock action 36 36 */ 37 37 public function register_bulk_action( $actions ){ … … 68 68 /** 69 69 * Processing Lock and Unlock users on request of bulk action 70 *71 * @param string $sendback Redirect back URL72 * @param string $current_action Current screen id73 * @param array $userids Array of users IDs74 * @return string Redirect back URL75 70 */ 76 public function process_lock_action( $sendback, $current_action, $userids ){ 77 // Process lock request 78 if( 'lock' === $current_action ){ 79 $current_user_id = get_current_user_id(); 80 foreach( $userids as $userid ){ 81 if( $userid == $current_user_id ) continue; 82 update_user_meta( (int)$userid, sanitize_key( 'baba_user_locked' ), 'yes' ); 71 public function process_lock_action(){ 72 73 if ( isset( $_GET['_wpnonce'] ) && ! empty( $_GET['_wpnonce'] ) && wp_get_referer() == '/wp-admin/users.php' ){ 74 $action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING ); 75 76 // check the action is not supposed to catch 77 if( 'lock' !== $action && 'unlock' !== $action ){ 78 return; 79 } 80 81 // security check one 82 if ( ! check_admin_referer( 'bulk-users' ) ) { 83 return; 84 } 85 86 // security check two 87 if( ! current_user_can( 'create_users' ) ){ 88 return; 89 } 90 91 // secure input for user ids 92 $userids = []; 93 if( isset( $_GET['users'] ) && is_array( $_GET['users'] ) && !empty( $_GET['users'] ) ){ 94 foreach( $_GET['users'] as $user_id ){ 95 $userids[] = (int)$user_id; 96 } 97 } 98 else{ 99 return; 100 } 101 102 // Process lock request 103 if( 'lock' === $action ){ 104 $current_user_id = get_current_user_id(); 105 foreach( $userids as $userid ){ 106 if( $userid == $current_user_id ) continue; 107 update_user_meta( (int)$userid, sanitize_key( 'baba_user_locked' ), 'yes' ); 108 } 109 } 110 111 // Process unlock request 112 elseif( 'unlock' === $action ){ 113 foreach( $userids as $userid ){ 114 update_user_meta( (int)$userid, sanitize_key( 'baba_user_locked' ), '' ); 115 } 83 116 } 84 117 } 85 // Process unlock request86 elseif( 'unlock' === $current_action ){87 foreach( $userids as $userid ){88 update_user_meta( (int)$userid, sanitize_key( 'baba_user_locked' ), '' );89 }90 }91 return $sendback;92 118 } 93 119 } -
lock-user-account/trunk/lock-user-account.php
r2649041 r2959610 4 4 * Plugin URI: http://teknigar.com 5 5 * Description: Lock user accounts with custom message 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 * Author: teknigar 8 8 * Author URI: http://teknigar.com -
lock-user-account/trunk/readme.txt
r2779828 r2959610 4 4 Requires at least: 4.3 5 5 Tested up to: 6.0.2 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 56 56 Prevented current user from being locked 57 57 58 = 1.0.4 = 59 Updated for WP 5.8 60 Added security patch 61 58 62 == Upgrade Notice == 59 63 60 = 1.0. 3=64 = 1.0.4 = 61 65 Updated version
Note: See TracChangeset
for help on using the changeset viewer.