Make WordPress Core

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

File class-wp-users-list-table.diff, 1.6 KB (added by wpdavis, 13 years ago)

Removing extra switch_to_blog

  • 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
    7073                $this->items = $wp_user_search->get_results();
     74               
     75                if ( $this->is_site_users )
     76                        restore_current_blog();
    7177
    7278                $this->set_pagination_args( array(
    7379                        'total_items' => $wp_user_search->get_total(),
     
    8692                        $url = 'site-users.php?id=' . $this->site_id;
    8793                        switch_to_blog( $this->site_id );
    8894                        $users_of_blog = count_users();
     95                        $roles = wp_roles->get_names();
    8996                        restore_current_blog();
    9097                } else {
    9198                        $url = 'users.php';
    9299                        $users_of_blog = count_users();
     100                        $roles = wp_roles->get_names();
    93101                }
    94102                $total_users = $users_of_blog['total_users'];
    95103                $avail_roles =& $users_of_blog['avail_roles'];
     
    99107                $class = empty($role) ? ' class="current"' : '';
    100108                $role_links = array();
    101109                $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 ) {
     110                foreach ( $roles as $this_role => $name ) {
    103111                        if ( !isset($avail_roles[$this_role]) )
    104112                                continue;
    105113