Make WordPress Core


Ignore:
Timestamp:
04/03/2010 05:14:34 AM (14 years ago)
Author:
nacin
Message:

Make remove_user a meta capability. see #12793

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/users.php

    r13894 r13956  
    1616    wp_die(__('Cheatin’ uh?'));
    1717
    18 $del_cap_type = 'remove';
    19 if ( !is_multisite() && current_user_can('delete_users') )
    20     $del_cap_type = 'delete';
     18if ( ! is_multisite() && current_user_can('delete_users') ) {
     19    $del_cap_user = 'delete_user';
     20    $del_cap_users = 'delete_users';
     21} else {
     22    $del_cap_user = 'remove_user';
     23    $del_cap_users = 'remove_users';
     24}
    2125
    2226$title = __('Users');
     
    8690    }
    8791
    88     if ( !current_user_can($del_cap_type . '_users') )
    89         wp_die(__('You can’t delete users.'));
     92    if ( ! current_user_can($del_cap_users ) )
     93        wp_die(__('You can’t remove users.'));
    9094
    9195    $userids = $_REQUEST['users'];
     
    9498
    9599    foreach ( (array) $userids as $id) {
    96         if ( ! current_user_can($del_cap_type . '_user', $id) )
    97             wp_die(__('You can’t delete that user.'));
     100        if ( ! current_user_can( $del_cap_user, $id ) )
     101            wp_die(__( 'You can’t remove that user.' ) );
    98102
    99103        if ( $id == $current_user->ID ) {
     
    133137    }
    134138
    135     if ( !current_user_can($del_cap_type . '_users') )
    136         $errors = new WP_Error('edit_users', __('You can’t delete users.'));
     139    if ( ! current_user_can( $del_cap_users ) )
     140        $errors = new WP_Error( 'edit_users', __( 'You can’t delete users.' ) );
    137141
    138142    if ( empty($_REQUEST['users']) )
Note: See TracChangeset for help on using the changeset viewer.