Skip to content

Commit

Permalink
Clean code around wp_redirect's
Browse files Browse the repository at this point in the history
  • Loading branch information
joshbetz committed Jun 15, 2012
1 parent 335fdee commit 64b5a5d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions vip-dashboard.php
Expand Up @@ -229,7 +229,6 @@ public function add_users_form() { ?>
*/
public function handle_add_users_form() {
global $wpdb;
$redirect = 'admin.php?page=vip_dashboard_users';

if ( !isset($_REQUEST['action']) || 'adduser' != $_REQUEST['action'] )
return;
Expand All @@ -251,17 +250,18 @@ public function handle_add_users_form() {
$errors = $this->create_users($blogids, $emails, $role, $message, $noconfirmation);
if ( isset( $errors ) ) {
$errors = explode(':', $errors);
$update = $errors[0];
$people = $errors[1];
$redirect = add_query_arg( array('update' => $update), $redirect );
$redirect = add_query_arg( array('users' => $people), $redirect );
$args = array(
'update' => $errors[0],
'people' => $errors[1]
);
} elseif ( $noconfirmation ) {
$redirect = add_query_arg( array('update' => 'addnoconfirmation'), $redirect );
$args = array( 'update' => 'addnoconfirmation' );
} else {
$redirect = add_query_arg( array('update' => 'newuserconfimation'), $redirect );
$args = array( 'update' => 'newuserconfimation' );
}
}

$redirect = add_query_arg( $args, 'admin.php?page=vip_dashboard_users');
wp_redirect( $redirect );
exit();
}
Expand Down Expand Up @@ -380,7 +380,7 @@ public function handle_promote_users_form() {

$this->promote_users($blogids, $userids, $role);

wp_redirect(add_query_arg('update', $update, $redirect));
wp_redirect( add_query_arg('update', $update, $redirect) );
exit();
}

Expand Down

0 comments on commit 64b5a5d

Please sign in to comment.