Ticket #2874: 2874.1.diff
| File 2874.1.diff, 2.0 KB (added by , 11 years ago) |
|---|
-
src/includes/admin/users.php
42 42 */ 43 43 function setup_actions() { 44 44 45 global $wp_version; 46 45 47 // Bail if in network admin 46 48 if ( is_network_admin() ) { 47 49 return; … … 52 54 53 55 // WordPress user screen 54 56 add_action( 'restrict_manage_users', array( $this, 'user_role_bulk_dropdown' ) ); 55 add_filter( 'manage_users_columns', array( $this, 'user_role_column' ) );56 add_filter( 'manage_users_custom_column', array( $this, 'user_role_row' ), 10, 3 );57 57 58 // In WordPress >= 4.4, all roles are listed in the table so we don't need the additional columns. 59 $wp_major_version = substr( $wp_version, 0, 3 ); 60 if( version_compare( $wp_major_version, 4.4, '<' ) ){ 61 add_filter( 'manage_users_columns', array( $this, 'user_role_column' ) ); 62 add_filter( 'manage_users_custom_column', array( $this, 'user_role_row' ), 10, 3 ); 63 } 64 58 65 // Process bulk role change 59 66 add_action( 'load-users.php', array( $this, 'user_role_bulk_change' ) ); 60 67 } … … 127 134 */ 128 135 public static function user_role_bulk_dropdown() { 129 136 130 // Bail if current user cannot promote users 137 // Bail if current user cannot promote users 131 138 if ( ! current_user_can( 'promote_users' ) ) { 132 139 return; 133 140 } … … 182 189 // Bail if nonce check fails 183 190 check_admin_referer( 'bbp-bulk-users', 'bbp-bulk-users-nonce' ); 184 191 185 // Bail if current user cannot promote users 192 // Bail if current user cannot promote users 186 193 if ( ! current_user_can( 'promote_users' ) ) { 187 194 return; 188 195 } … … 200 207 } 201 208 202 209 // Set up user and role data 203 $user_role = bbp_get_user_role( $user_id ); 210 $user_role = bbp_get_user_role( $user_id ); 204 211 $new_role = sanitize_text_field( $_REQUEST['bbp-new-role'] ); 205 212 206 213 // Only keymasters can set other keymasters
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)