Make WordPress Core


Ignore:
Timestamp:
10/04/2017 10:16:21 PM (6 years ago)
Author:
johnbillion
Message:

Users: Revert [41613], [41614], and [41623] as this feature needs some more work.

See #38741

File:
1 edited

Legend:

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

    r41683 r41753  
    167167
    168168        $wp_roles = wp_roles();
    169         $count_users = true;
    170 
    171         if ( wp_is_large_user_count() ) {
    172             $count_users = false;
    173         } elseif ( is_multisite() && wp_is_large_network( 'users' ) ) {
    174             $count_users = false;
    175         }
    176169
    177170        if ( $this->is_site_users ) {
    178171            $url = 'site-users.php?id=' . $this->site_id;
    179             if ( $count_users ) {
    180                 switch_to_blog( $this->site_id );
    181                 $users_of_blog = count_users( 'time', $this->site_id );
    182                 restore_current_blog();
    183             }
     172            switch_to_blog( $this->site_id );
     173            $users_of_blog = count_users( 'time', $this->site_id );
     174            restore_current_blog();
    184175        } else {
    185176            $url = 'users.php';
    186             if ( $count_users ) {
    187                 $users_of_blog = count_users();
    188             }
    189         }
    190 
    191         if ( $count_users ) {
    192             $total_users = $users_of_blog['total_users'];
    193             $avail_roles =& $users_of_blog['avail_roles'];
    194             unset($users_of_blog);
    195         } else {
    196             $avail_roles = array();
    197         }
     177            $users_of_blog = count_users();
     178        }
     179
     180        $total_users = $users_of_blog['total_users'];
     181        $avail_roles =& $users_of_blog['avail_roles'];
     182        unset($users_of_blog);
    198183
    199184        $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : '';
    200185
    201186        $role_links = array();
    202 
    203         if ( $count_users ) {
    204             $role_links['all'] = "<a href='$url'$current_link_attributes>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
    205         } else {
    206             $role_links['all'] = "<a href='$url'$current_link_attributes>" . _x( 'All', 'users' ) . '</a>';
    207         }
     187        $role_links['all'] = "<a href='$url'$current_link_attributes>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
    208188        foreach ( $wp_roles->get_names() as $this_role => $name ) {
    209             if ( $count_users && !isset($avail_roles[$this_role]) ) {
     189            if ( !isset($avail_roles[$this_role]) )
    210190                continue;
    211             }
    212191
    213192            $current_link_attributes = '';
     
    218197
    219198            $name = translate_user_role( $name );
    220             if ( $count_users ) {
    221                 /* translators: User role name with count */
    222                 $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) );
    223             }
     199            /* translators: User role name with count */
     200            $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) );
    224201            $role_links[$this_role] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$current_link_attributes>$name</a>";
    225202        }
    226203
    227         if ( ! $count_users || ! empty( $avail_roles['none' ] ) ) {
     204        if ( ! empty( $avail_roles['none' ] ) ) {
    228205
    229206            $current_link_attributes = '';
     
    234211
    235212            $name = __( 'No role' );
    236             if ( $count_users ) {
    237                 /* translators: User role name with count */
    238                 $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles['none' ] ) );
    239             }
     213            /* translators: User role name with count */
     214            $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles['none' ] ) );
    240215            $role_links['none'] = "<a href='" . esc_url( add_query_arg( 'role', 'none', $url ) ) . "'$current_link_attributes>$name</a>";
    241216
Note: See TracChangeset for help on using the changeset viewer.