Make WordPress Core

Ticket #16293: 16293.2.diff

File 16293.2.diff, 631 bytes (added by Ipstenu, 12 years ago)

Editing users.php to check for SuperAdmin in a non-hardcodey way.

  • users.php

     
    9797                        check_admin_referer( 'deleteuser' );
    9898
    9999                        $id = intval( $_GET['id'] );
    100                         if ( $id != '0' && $id != '1' ) {
     100                        $user = get_userdata( $id );
     101                        if ( ! is_super_admin( $id ) || ( $user->user_email != get_site_option( 'admin_email' ) && get_current_user_id() != $id && count( get_super_admins() ) > 1 ) ) {
    101102                                $_POST['allusers'] = array( $id ); // confirm_delete_users() can only handle with arrays
    102103                                $title = __( 'Users' );
    103104                                $parent_file = 'users.php';