Ticket #36196: 36196.diff
| File 36196.diff, 2.0 KB (added by , 10 years ago) |
|---|
-
src/wp-admin/includes/class-wp-users-list-table.php
98 98 $args = array( 99 99 'number' => $users_per_page, 100 100 'offset' => ( $paged-1 ) * $users_per_page, 101 'include' => wp_get_users_with_no_role( ),101 'include' => wp_get_users_with_no_role( $this->site_id ), 102 102 'search' => $usersearch, 103 103 'fields' => 'all_with_meta' 104 104 ); … … 354 354 $post_counts = count_many_users_posts( array_keys( $this->items ) ); 355 355 356 356 foreach ( $this->items as $userid => $user_object ) { 357 if ( is_multisite() && empty( $user_object->allcaps ) )358 continue;359 360 357 echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 ); 361 358 } 362 359 } -
src/wp-includes/user.php
2406 2406 /** 2407 2407 * Get the user IDs of all users with no role on this site. 2408 2408 * 2409 * This function returns an empty array when used on Multisite.2410 *2411 2409 * @since 4.4.0 2410 * @since 4.6.0 The `$site_id` parameter was added to support multisite. 2412 2411 * 2412 * @param int|null $site_id Optional. The site ID to get users with no role for. Defaults to the current site. 2413 * 2413 2414 * @return array Array of user IDs. 2414 2415 */ 2415 function wp_get_users_with_no_role( ) {2416 function wp_get_users_with_no_role( $site_id = null ) { 2416 2417 global $wpdb; 2417 2418 2418 if ( is_multisite()) {2419 return array();2419 if ( ! $site_id ) { 2420 $site_id = get_current_blog_id(); 2420 2421 } 2421 2422 2422 $prefix = $wpdb->get_blog_prefix( );2423 $prefix = $wpdb->get_blog_prefix( $site_id ); 2423 2424 $regex = implode( '|', wp_roles()->get_names() ); 2424 2425 $regex = preg_replace( '/[^a-zA-Z_\|-]/', '', $regex ); 2425 2426 $users = $wpdb->get_col( $wpdb->prepare( "