Ticket #46122: 46122.2.diff
File 46122.2.diff, 5.9 KB (added by , 6 years ago) |
---|
-
src/wp-admin/includes/class-wp-ms-users-list-table.php
133 133 protected function get_views() { 134 134 global $role; 135 135 136 $role_links = array(); 137 136 138 $total_users = get_user_count(); 139 140 $current_link_attributes = $role !== 'super' ? ' class="current" aria-current="page"' : ''; 141 $status_label = sprintf( 142 /* translators: %s: all users count */ 143 _nx( 144 'All <span class="count">(%s)</span>', 145 'All <span class="count">(%s)</span>', 146 $total_users, 147 'user roles' 148 ), 149 number_format_i18n( $total_users ) 150 ); 151 152 $role_links['all'] = sprintf( 153 '<a href="%s"%s>%s</a>', 154 esc_url( network_admin_url( 'users.php' ) ), 155 $current_link_attributes, 156 $status_label 157 ); 158 137 159 $super_admins = get_super_admins(); 138 160 $total_admins = count( $super_admins ); 139 161 140 $current_link_attributes = $role !== 'super' ? ' class="current" aria-current="page"' : '';141 $role_links = array();142 $role_links['all'] = "<a href='" . network_admin_url( 'users.php' ) . "'$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>';143 162 $current_link_attributes = $role === 'super' ? ' class="current" aria-current="page"' : ''; 144 $role_links['super'] = "<a href='" . network_admin_url( 'users.php?role=super' ) . "'$current_link_attributes>" . sprintf( _n( 'Super Admin <span class="count">(%s)</span>', 'Super Admins <span class="count">(%s)</span>', $total_admins ), number_format_i18n( $total_admins ) ) . '</a>'; 163 $status_label = sprintf( 164 /* translators: %s: all users count */ 165 _nx( 166 'Super Admin <span class="count">(%s)</span>', 167 'Super Admins <span class="count">(%s)</span>', 168 $total_admins, 169 'user roles' 170 ), 171 number_format_i18n( $total_admins ) 172 ); 145 173 174 $role_links['super'] = sprintf( 175 '<a href="%s"%s>%s</a>', 176 esc_url( network_admin_url( 'users.php?role=super' ) ), 177 $current_link_attributes, 178 $status_label 179 ); 180 146 181 return $role_links; 147 182 } 148 183 -
src/wp-admin/includes/class-wp-users-list-table.php
175 175 protected function get_views() { 176 176 global $role; 177 177 178 $wp_roles = wp_roles(); 178 $wp_roles = wp_roles(); 179 $role_links = array(); 179 180 180 181 if ( $this->is_site_users ) { 181 182 $url = 'site-users.php?id=' . $this->site_id; … … 192 193 unset( $users_of_blog ); 193 194 194 195 $current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : ''; 196 $status_label = sprintf( 197 /* translators: %s: all users count */ 198 _nx( 199 'All <span class="count">(%s)</span>', 200 'All <span class="count">(%s)</span>', 201 $total_users, 202 'user roles' 203 ), 204 number_format_i18n( $total_users ) 205 ); 195 206 196 $role_links = array(); 197 $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>'; 198 foreach ( $wp_roles->get_names() as $this_role => $name ) { 207 $role_links['all'] = sprintf( 208 '<a href="%s"%s>%s</a>', 209 esc_url( $url ), 210 $current_link_attributes, 211 $status_label 212 ); 213 214 foreach ( $wp_roles->get_names() as $this_role => $role_name ) { 199 215 if ( ! isset( $avail_roles[ $this_role ] ) ) { 200 216 continue; 201 217 } 202 218 203 $current_link_attributes = ''; 219 $current_link_attributes = $this_role === $role ? ' class="current" aria-current="page"' : ''; 220 $role_name = sprintf( 221 /* translators: User role name with count */ 222 __( '%1$s <span class="count">(%2$s)</span>' ), 223 translate_user_role( $role_name ), 224 number_format_i18n( $avail_roles[ $this_role ] ) 225 ); 204 226 205 if ( $this_role === $role ) { 206 $current_link_attributes = ' class="current" aria-current="page"'; 207 } 208 209 $name = translate_user_role( $name ); 210 /* translators: User role name with count */ 211 $name = sprintf( __( '%1$s <span class="count">(%2$s)</span>' ), $name, number_format_i18n( $avail_roles[ $this_role ] ) ); 212 $role_links[ $this_role ] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$current_link_attributes>$name</a>"; 227 $role_links[ $this_role ] = sprintf( 228 '<a href="%s"%s>%s</a>', 229 esc_url( add_query_arg( 'role', $this_role, $url ) ), 230 $current_link_attributes, 231 $role_name 232 ); 213 233 } 214 234 215 235 if ( ! empty( $avail_roles['none'] ) ) { 216 236 217 $current_link_attributes = ''; 237 $current_link_attributes = 'none' === $role ? ' class="current" aria-current="page"' : ''; 238 $role_name = sprintf( 239 /* translators: User role name with count */ 240 __( '%1$s <span class="count">(%2$s)</span>' ), 241 /* translators: No role available */ 242 __( 'No role' ), 243 number_format_i18n( $avail_roles['none'] ) 244 ); 218 245 219 if ( 'none' === $role ) { 220 $current_link_attributes = ' class="current" aria-current="page"'; 221 } 246 $role_links[ 'none' ] = sprintf( 247 '<a href="%s"%s>%s</a>', 248 esc_url( add_query_arg( 'role', 'none', $url ) ), 249 $current_link_attributes, 250 $role_name 251 ); 222 252 223 $name = __( 'No role' );224 /* translators: User role name with count */225 $name = sprintf( __( '%1$s <span class="count">(%2$s)</span>' ), $name, number_format_i18n( $avail_roles['none'] ) );226 $role_links['none'] = "<a href='" . esc_url( add_query_arg( 'role', 'none', $url ) ) . "'$current_link_attributes>$name</a>";227 228 253 } 229 254 230 255 return $role_links;