Ticket #42552: 42552.diff
File 42552.diff, 2.3 KB (added by , 7 years ago) |
---|
-
src/wp-admin/includes/class-wp-ms-users-list-table.php
233 233 public function column_username( $user ) { 234 234 $super_admins = get_super_admins(); 235 235 $avatar = get_avatar( $user->user_email, 32 ); 236 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );237 236 238 237 echo $avatar; 239 238 240 ?><strong><a href="<?php echo $edit_link; ?>" class="edit"><?php echo $user->user_login; ?></a><?php 241 if ( in_array( $user->user_login, $super_admins ) ) { 242 echo ' — ' . __( 'Super Admin' ); 239 if ( current_user_can( 'edit_user', $user->ID ) ) { 240 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 241 $edit = "<a href=\"{$edit_link}\">{$user->user_login}</a>"; 242 } else { 243 $edit = $user->user_login; 243 244 } 244 ?></strong> 245 <?php 245 246 ?> 247 <strong> 248 <?php 249 echo $edit; 250 251 if ( in_array( $user->user_login, $super_admins ) ) { 252 echo ' — ' . __( 'Super Admin' ); 253 } 254 ?> 255 </strong> 256 <?php 246 257 } 247 258 248 259 /** … … 429 440 } 430 441 431 442 $super_admins = get_super_admins(); 432 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );433 443 434 444 $actions = array(); 435 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';436 445 446 if ( current_user_can( 'edit_user', $user->ID ) ) { 447 $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); 448 $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; 449 } 450 437 451 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 438 452 $actions['delete'] = '<a href="' . $delete = esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 439 453 }