WordPress.org

Make WordPress Core

Ticket #19765: class-wp-users-list-table.patch

File class-wp-users-list-table.patch, 1.7 KB (added by wpdavis, 6 years ago)
  • wp-admin/includes/class-wp-users-list-table.php

     
    6464                if ( isset( $_REQUEST['order'] ) )
    6565                        $args['order'] = $_REQUEST['order'];
    6666
     67                if ( $this->is_site_users )
     68                        switch_to_blog( $this->site_id );
     69
    6770                // Query the user IDs for this page
    6871                $wp_user_search = new WP_User_Query( $args );
    6972
     73                if ( $this->is_site_users )
     74                        switch_to_blog( $this->site_id );
     75
    7076                $this->items = $wp_user_search->get_results();
     77               
     78                if ( $this->is_site_users )
     79                        restore_current_blog();
    7180
    7281                $this->set_pagination_args( array(
    7382                        'total_items' => $wp_user_search->get_total(),
     
    8695                        $url = 'site-users.php?id=' . $this->site_id;
    8796                        switch_to_blog( $this->site_id );
    8897                        $users_of_blog = count_users();
     98                        $roles = wp_roles->get_names();
    8999                        restore_current_blog();
    90100                } else {
    91101                        $url = 'users.php';
    92102                        $users_of_blog = count_users();
     103                        $roles = wp_roles->get_names();
    93104                }
    94105                $total_users = $users_of_blog['total_users'];
    95106                $avail_roles =& $users_of_blog['avail_roles'];
     
    99110                $class = empty($role) ? ' class="current"' : '';
    100111                $role_links = array();
    101112                $role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
    102                 foreach ( $wp_roles->get_names() as $this_role => $name ) {
     113                foreach ( $roles as $this_role => $name ) {
    103114                        if ( !isset($avail_roles[$this_role]) )
    104115                                continue;
    105116