- Timestamp:
- 03/29/2022 12:41:00 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-users-list-table.php
r52581 r53011 178 178 $wp_roles = wp_roles(); 179 179 180 $count_users = ! wp_is_large_user_count(); 181 180 182 if ( $this->is_site_users ) { 181 183 $url = 'site-users.php?id=' . $this->site_id; 182 switch_to_blog( $this->site_id );183 $users_of_blog = count_users( 'time', $this->site_id );184 restore_current_blog();185 184 } else { 186 $url = 'users.php'; 187 $users_of_blog = count_users(); 188 } 189 190 $total_users = $users_of_blog['total_users']; 191 $avail_roles =& $users_of_blog['avail_roles']; 192 unset( $users_of_blog ); 193 185 $url = 'users.php'; 186 } 187 188 $role_links = array(); 189 $avail_roles = array(); 190 $all_text = __( 'All' ); 194 191 $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : ''; 195 192 196 $role_links = array(); 197 $role_links['all'] = sprintf( 198 '<a href="%s"%s>%s</a>', 199 $url, 200 $current_link_attributes, 201 sprintf( 193 if ( $count_users ) { 194 if ( $this->is_site_users ) { 195 switch_to_blog( $this->site_id ); 196 $users_of_blog = count_users( 'time', $this->site_id ); 197 restore_current_blog(); 198 } else { 199 $users_of_blog = count_users(); 200 } 201 202 $total_users = $users_of_blog['total_users']; 203 $avail_roles =& $users_of_blog['avail_roles']; 204 unset( $users_of_blog ); 205 206 $all_text = sprintf( 202 207 /* translators: %s: Number of users. */ 203 208 _nx( … … 208 213 ), 209 214 number_format_i18n( $total_users ) 210 ) 211 ); 215 ); 216 } 217 218 $role_links['all'] = sprintf( '<a href="%s"%s>%s</a>', $url, $current_link_attributes, $all_text ); 212 219 213 220 foreach ( $wp_roles->get_names() as $this_role => $name ) { 214 if ( ! isset( $avail_roles[ $this_role ] ) ) {221 if ( $count_users && ! isset( $avail_roles[ $this_role ] ) ) { 215 222 continue; 216 223 } … … 223 230 224 231 $name = translate_user_role( $name ); 225 $name = sprintf( 226 /* translators: 1: User role name, 2: Number of users. */ 227 __( '%1$s <span class="count">(%2$s)</span>' ), 228 $name, 229 number_format_i18n( $avail_roles[ $this_role ] ) 230 ); 232 if ( $count_users ) { 233 $name = sprintf( 234 /* translators: 1: User role name, 2: Number of users. */ 235 __( '%1$s <span class="count">(%2$s)</span>' ), 236 $name, 237 number_format_i18n( $avail_roles[ $this_role ] ) 238 ); 239 } 231 240 232 241 $role_links[ $this_role ] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$current_link_attributes>$name</a>";
Note: See TracChangeset
for help on using the changeset viewer.