- Timestamp:
- 09/27/2017 01:03:03 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-users-list-table.php
r41180 r41613 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 } 169 176 170 177 if ( $this->is_site_users ) { 171 178 $url = 'site-users.php?id=' . $this->site_id; 172 switch_to_blog( $this->site_id ); 173 $users_of_blog = count_users( 'time', $this->site_id ); 174 restore_current_blog(); 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 } 175 184 } else { 176 185 $url = 'users.php'; 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); 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 } 183 198 184 199 $class = empty($role) ? ' class="current"' : ''; 185 200 $role_links = array(); 186 $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>'; 201 202 if ( $count_users ) { 203 $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>'; 204 } else { 205 $role_links['all'] = "<a href='$url'$class>" . _x( 'All', 'users' ) . '</a>'; 206 } 187 207 foreach ( $wp_roles->get_names() as $this_role => $name ) { 188 if ( !isset($avail_roles[$this_role]) )208 if ( $count_users && !isset($avail_roles[$this_role]) ) { 189 209 continue; 210 } 190 211 191 212 $class = ''; … … 196 217 197 218 $name = translate_user_role( $name ); 198 /* translators: User role name with count */ 199 $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) ); 219 if ( $count_users ) { 220 /* translators: User role name with count */ 221 $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) ); 222 } 200 223 $role_links[$this_role] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$class>$name</a>"; 201 224 } 202 225 203 if ( ! empty( $avail_roles['none' ] ) ) {226 if ( ! $count_users || ! empty( $avail_roles['none' ] ) ) { 204 227 205 228 $class = ''; … … 210 233 211 234 $name = __( 'No role' ); 212 /* translators: User role name with count */ 213 $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles['none' ] ) ); 235 if ( $count_users ) { 236 /* translators: User role name with count */ 237 $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles['none' ] ) ); 238 } 214 239 $role_links['none'] = "<a href='" . esc_url( add_query_arg( 'role', 'none', $url ) ) . "'$class>$name</a>"; 215 240
Note: See TracChangeset
for help on using the changeset viewer.