Make WordPress Core


Ignore:
Timestamp:
01/13/2011 12:50:35 AM (16 years ago)
Author:
nacin
Message:

Revert [17275] and [17276]. The rabbit hole is too deep. see #16166.

File:
1 edited

Legend:

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

    r17275 r17277  
    4343$update = '';
    4444
    45 if ( $doaction = $wp_list_table->current_action() ) {
    46 
    47 switch ( $doaction ) {
     45switch ( $wp_list_table->current_action() ) {
    4846
    4947/* Bulk Dropdown menu Role changes */
    … …  
    5149        check_admin_referer('bulk-users');
    5250
    53         if ( empty($_REQUEST['users']) )
    54                 break;
     51        if ( empty($_REQUEST['users']) ) {
     52                wp_redirect($redirect);
     53                exit();
     54        }
    5555
    5656        $editable_roles = get_editable_roles();
    … …  
    6666                        wp_die(__('You can’t edit that user.'));
    6767                // The new role of the current user must also have promote_users caps
    68                 if ( $id == $current_user->ID && ! current_user_can('promote_users') ) {
     68                if ( $id == $current_user->ID && !$wp_roles->role_objects[$_REQUEST['new_role']]->has_cap('promote_users') ) {
    6969                        $update = 'err_admin_role';
    7070                        continue;
    … …  
    7979        }
    8080
    81         $redirect = add_query_arg( 'update', $update, $redirect );
     81        wp_redirect(add_query_arg('update', $update, $redirect));
     82        exit();
    8283
    8384break;
    … …  
    8990        check_admin_referer('delete-users');
    9091
    91         if ( empty($_REQUEST['users']) )
    92                 break;
     92        if ( empty($_REQUEST['users']) ) {
     93                wp_redirect($redirect);
     94                exit();
     95        }
    9396
    9497        if ( ! current_user_can( 'delete_users' ) )
    … …  
    123126
    124127        $redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect);
     128        wp_redirect($redirect);
     129        exit();
    125130
    126131break;
    … …  
    132137        check_admin_referer('bulk-users');
    133138
    134         if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) )
    135                 break;
     139        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
     140                wp_redirect($redirect);
     141                exit();
     142        }
    136143
    137144        if ( ! current_user_can( 'delete_users' ) )
    … …  
    142149        else
    143150                $userids = $_REQUEST['users'];
    144 
    145         $redirect = false;
    146151
    147152        include ('admin-header.php');
    … …  
    187192</form>
    188193<?php
    189 include('./admin-footer.php');
    190194
    191195break;
    … …  
    194198        check_admin_referer('remove-users');
    195199
    196         if ( empty($_REQUEST['users']) )
    197                 break;
     200        if ( empty($_REQUEST['users']) ) {
     201                wp_redirect($redirect);
     202                exit;
     203        }
    198204
    199205        if ( !current_user_can('remove_users')  )
    … …  
    217223
    218224        $redirect = add_query_arg( array('update' => $update), $redirect);
     225        wp_redirect($redirect);
     226        exit;
    219227
    220228break;
    … …  
    224232        check_admin_referer('bulk-users');
    225233
    226         if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) )
    227                 break;
     234        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
     235                wp_redirect($redirect);
     236                exit();
     237        }
    228238
    229239        if ( !current_user_can('remove_users') )
    … …  
    234244        else
    235245                $userids = $_REQUEST['users'];
    236 
    237         $redirect = false;
    238246
    239247        include ('admin-header.php');
    … …  
    272280</form>
    273281<?php
    274 include('./admin-footer.php');
    275282
    276283break;
    … …  
    278285default:
    279286
    280 } // end of the $doaction switch
    281 
    282         if ( $redirect )
    283                 wp_redirect( $redirect );
    284         exit();
    285 
    286 } // end of the $doaction if
    287 elseif ( !empty($_GET['_wp_http_referer']) ) {
     287        if ( !empty($_GET['_wp_http_referer']) ) {
    288288                wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
    289289                exit;
    290 }
     290        }
    291291
    292292        $wp_list_table->prepare_items();
    … …  
    379379</div>
    380380<?php
     381break;
     382
     383} // end of the $doaction switch
    381384
    382385include('./admin-footer.php');
Note: See TracChangeset for help on using the changeset viewer.