- Timestamp:
- 10/04/2017 10:16:21 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-users-list-table.php
r41683 r41753 167 167 168 168 $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 }176 169 177 170 if ( $this->is_site_users ) { 178 171 $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(); 184 175 } else { 185 176 $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); 198 183 199 184 $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : ''; 200 185 201 186 $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>'; 208 188 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]) ) 210 190 continue; 211 }212 191 213 192 $current_link_attributes = ''; … … 218 197 219 198 $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] ) ); 224 201 $role_links[$this_role] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$current_link_attributes>$name</a>"; 225 202 } 226 203 227 if ( ! $count_users || !empty( $avail_roles['none' ] ) ) {204 if ( ! empty( $avail_roles['none' ] ) ) { 228 205 229 206 $current_link_attributes = ''; … … 234 211 235 212 $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' ] ) ); 240 215 $role_links['none'] = "<a href='" . esc_url( add_query_arg( 'role', 'none', $url ) ) . "'$current_link_attributes>$name</a>"; 241 216
Note: See TracChangeset
for help on using the changeset viewer.