Users: Show a Super Admin label next to Super Admins on all user listing screens when the current user can manage network users.

Fixes #41165

Built from https://develop.svn.wordpress.org/trunk@41150


git-svn-id: http://core.svn.wordpress.org/trunk@40990 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2017-07-25 17:43:42 +00:00
parent de31d6f81c
commit 2dfea4210b
3 changed files with 13 additions and 5 deletions

View File

@ -243,7 +243,7 @@ class WP_MS_Users_List_Table extends WP_List_Table {
?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php
if ( in_array( $user->user_login, $super_admins ) ) {
echo ' - ' . __( 'Super Admin' );
echo ' &mdash; ' . __( 'Super Admin' );
}
?></strong>
<?php

View File

@ -405,16 +405,24 @@ class WP_Users_List_Table extends WP_List_Table {
// Set up the hover actions for this user
$actions = array();
$checkbox = '';
$super_admin = '';
if ( is_multisite() && current_user_can( 'manage_network_users' ) ) {
if ( in_array( $user_object->user_login, get_super_admins(), true ) ) {
$super_admin = ' &mdash; ' . __( 'Super Admin' );
}
}
// Check if the user for this row is editable
if ( current_user_can( 'list_users' ) ) {
// Set up the user editing link
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
if ( current_user_can( 'edit_user', $user_object->ID ) ) {
$edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
$edit = "<strong><a href=\"{$edit_link}\">{$user_object->user_login}</a>{$super_admin}</strong><br />";
$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
} else {
$edit = "<strong>$user_object->user_login</strong><br />";
$edit = "<strong>{$user_object->user_login}{$super_admin}</strong><br />";
}
if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) )
@ -453,7 +461,7 @@ class WP_Users_List_Table extends WP_List_Table {
. "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role_classes}' value='{$user_object->ID}' />";
} else {
$edit = '<strong>' . $user_object->user_login . '</strong>';
$edit = "<strong>{$user_object->user_login}{$super_admin}</strong>";
}
$avatar = get_avatar( $user_object->ID, 32 );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.9-alpha-41149';
$wp_version = '4.9-alpha-41150';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.