Skip to content

Commit

Permalink
Remove redundant checks and reorder code to avoid notices in the erro…
Browse files Browse the repository at this point in the history
…r log.
  • Loading branch information
joshbetz committed Jun 22, 2012
1 parent e315426 commit d148664
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions bulk-user-management.php
Expand Up @@ -456,20 +456,16 @@ public function handle_promote_users_form() {
check_admin_referer( 'bulk-user-management-bulk-users', 'bulk-user-management-bulk-users' );
$redirect = add_query_arg( 'page', $this->page_slug, $this->parent_page );

$blogids = array_map('intval', $_REQUEST['blogs']);
$userids = array_map('intval', $_REQUEST['users']);
$role = sanitize_key($_REQUEST['new_role']);

if ( ! current_user_can( 'promote_users' ) ) {
$error = new WP_Error( 'no-promote-user-cap', __( 'You can’t edit that user.', 'bulk-user-management' ) );
wp_die( $error->get_error_message() );
}

if ( empty($_REQUEST['users']) ) {
wp_redirect($redirect);
exit();
}

$blogids = array_map('intval', $_REQUEST['blogs']);
$userids = array_map('intval', $_REQUEST['users']);
$role = sanitize_key($_REQUEST['new_role']);


$editable_roles = get_editable_roles();
if ( empty( $editable_roles[$_REQUEST['new_role']] ) && 'none' != $_REQUEST['new_role'] ) {
$error = new WP_Error( 'no-editable-role', __( 'You can’t give users that role.', 'bulk-user-management' ) );
Expand Down

0 comments on commit d148664

Please sign in to comment.