if ( current_user_can( 'list_users'
) ) { $redirect = 'users.php?update=add&id=' .
$user_id;
} else { $redirect =
add_query_arg( 'update', 'add', 'user-new.php'
);
} wp_redirect( $redirect );
die();
} } else { // Adding a new user to this site.
$new_user_email =
wp_unslash( $_REQUEST['email'
] );
$user_details =
wpmu_validate_user_signup( $_REQUEST['user_login'
],
$new_user_email );
if ( is_wp_error( $user_details['errors'
] ) &&
$user_details['errors'
]->
has_errors() ) { $add_user_errors =
$user_details['errors'
];
} else { /** This filter is documented in wp-includes/user.php */
$new_user_login =
apply_filters( 'pre_user_login',
sanitize_user( wp_unslash( $_REQUEST['user_login'
] ), true
) );
if ( isset( $_POST['noconfirmation'
] ) &&
current_user_can( 'manage_network_users'
) ) { add_filter( 'wpmu_signup_user_notification', '__return_false'
); // Disable confirmation email.
add_filter( 'wpmu_welcome_user_notification', '__return_false'
); // Disable welcome email.
} wpmu_signup_user( $new_user_login,