~canonical-sysadmins/wordpress/4.9.1

« back to all changes in this revision

Viewing changes to wp-admin/users.php

  • Committer: Barry Price
  • Date: 2017-06-09 02:09:58 UTC
  • mfrom: (1.1.26 upstream)
  • Revision ID: barry.price@canonical.com-20170609020958-838whhwt2196f2vk
Merge WP4.8 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
                        wp_die(__('Sorry, you are not allowed to edit this user.'));
123
123
                // The new role of the current user must also have the promote_users cap or be a multisite super admin
124
124
                if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users')
125
 
                        && ! ( is_multisite() && is_super_admin() ) ) {
 
125
                        && ! ( is_multisite() && current_user_can( 'manage_network_users' ) ) ) {
126
126
                                $update = 'err_admin_role';
127
127
                                continue;
128
128
                }
321
321
        $update = 'remove';
322
322
        foreach ( $userids as $id ) {
323
323
                $id = (int) $id;
324
 
                if ( $id == $current_user->ID && !is_super_admin() ) {
325
 
                        $update = 'err_admin_remove';
326
 
                        continue;
327
 
                }
328
324
                if ( !current_user_can('remove_user', $id) ) {
329
325
                        $update = 'err_admin_remove';
330
326
                        continue;
377
373
        foreach ( $userids as $id ) {
378
374
                $id = (int) $id;
379
375
                $user = get_userdata( $id );
380
 
                if ( $id == $current_user->ID && !is_super_admin() ) {
381
 
                        /* translators: 1: user id, 2: user login */
382
 
                        echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
383
 
                } elseif ( !current_user_can('remove_user', $id) ) {
 
376
                if ( ! current_user_can( 'remove_user', $id ) ) {
384
377
                        /* translators: 1: user id, 2: user login */
385
378
                        echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>Sorry, you are not allowed to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
386
379
                } else {
491
484
} ?>
492
485
 
493
486
<div class="wrap">
494
 
<h1>
495
 
<?php
 
487
<h1 class="wp-heading-inline"><?php
496
488
echo esc_html( $title );
 
489
?></h1>
 
490
 
 
491
<?php
497
492
if ( current_user_can( 'create_users' ) ) { ?>
498
493
        <a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
499
494
<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
505
500
        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
506
501
}
507
502
?>
508
 
</h1>
 
503
 
 
504
<hr class="wp-header-end">
509
505
 
510
506
<?php $wp_list_table->views(); ?>
511
507
 
513
509
 
514
510
<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
515
511
 
 
512
<?php if ( ! empty( $_REQUEST['role'] ) ) { ?>
 
513
<input type="hidden" name="role" value="<?php echo esc_attr( $_REQUEST['role'] ); ?>" />
 
514
<?php } ?>
 
515
 
516
516
<?php $wp_list_table->display(); ?>
517
517
</form>
518
518