WordPress.org

Make WordPress Core

Changeset 16277


Ignore:
Timestamp:
11/10/2010 05:05:20 PM (11 years ago)
Author:
nacin
Message:

Super Admin filter for network/users.php. fixes #15371.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-ms-users-list-table.php

    r16182 r16277  
    2424
    2525    function prepare_items() {
    26         global $usersearch;
     26        global $usersearch, $role, $wpdb;
    2727
    2828        $usersearch = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
    2929
    3030        $users_per_page = $this->get_items_per_page( 'users_network_per_page' );
     31
     32        $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
    3133
    3234        $paged = $this->get_pagenum();
     
    3840            'blog_id' => 0
    3941        );
     42
     43        if ( $role == 'super' ) {
     44            $logins = implode( "', '", get_super_admins() );
     45            $args['include'] = $wpdb->get_col( "SELECT ID FROM $wpdb->users WHERE user_login IN ('$logins')" );
     46        }
    4047
    4148        // If the network is large and a search is not being performed, show only the latest users with no paging in order
     
    7784    function no_items() {
    7885        _e( 'No users found.' );
     86    }
     87
     88    function get_views() {
     89        global $wp_roles, $role;
     90
     91        $users_of_blog = count_users();
     92        $total_users = $users_of_blog['total_users'];
     93        $super_admins = get_super_admins();
     94        $total_admins = count( $super_admins );
     95        unset($users_of_blog);
     96
     97        $current_role = false;
     98        $class = $role != 'super' ? ' class="current"' : '';
     99        $role_links = array();
     100        $role_links['all'] = "<a href='" . network_admin_url('users.php') . "'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
     101        $class = $role == 'super' ? ' class="current"' : '';
     102        $role_links['super'] = "<a href='" . network_admin_url('users.php?role=super') . "'$class>" . sprintf( _n( 'Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins ), number_format_i18n( $total_admins ) ) . '</a>';
     103
     104        return $role_links;
    79105    }
    80106
     
    156182                            <?php echo $avatar; ?><strong><a href="<?php echo esc_url( self_admin_url( $edit_link ) ); ?>" class="edit"><?php echo stripslashes( $user->user_login ); ?></a><?php
    157183                            if ( in_array( $user->user_login, $super_admins ) )
    158                                 echo ' - ' . __( 'Super admin' );
     184                                echo ' - ' . __( 'Super Admin' );
    159185                            ?></strong>
    160186                            <br/>
Note: See TracChangeset for help on using the changeset viewer.