} if (!current_user_can('create_users')) { nxt_die(__('You do not have sufficient permissions to add users to this network.')); } get_current_screen()->add_help_tab(array('id' => 'overview', 'title' => __('Overview'), 'content' => '<p>' . __('Add User will set up a new user account on the network and send that person an email with username and password.') . '</p>' . '<p>' . __('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.') . '</p>')); get_current_screen()->set_help_sidebar('<p><strong>' . __('For more information:') . '</strong></p>' . '<p>' . __('<a href="http://codex.nxtclass.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' . '<p>' . __('<a href="http://nxtclass.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>'); if (isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action']) { check_admin_referer('add-user', '_nxtnonce_add-user'); if (!current_user_can('manage_network_users')) { nxt_die(__('You do not have permission to access this page.')); } if (!is_array($_POST['user'])) { nxt_die(__('Cannot create an empty user.')); } $user = $_POST['user']; $user_details = nxtmu_validate_user_signup($user['username'], $user['email']); if (is_nxt_error($user_details['errors']) && !empty($user_details['errors']->errors)) { $add_user_errors = $user_details['errors']; } else { $password = nxt_generate_password(12, false); $user_id = nxtmu_create_user(esc_html(strtolower($user['username'])), $password, esc_html($user['email'])); if (!$user_id) { $add_user_errors = new nxt_Error('add_user_fail', __('Cannot add user.')); } else { nxt_new_user_notification($user_id, $password); nxt_redirect(add_query_arg(array('update' => 'added'), 'user-new.php')); exit; } } } if (isset($_GET['update'])) {
function validate_blog_signup() { // Re-validate user info. $result = nxtmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); extract($result); if ($errors->get_error_code()) { signup_user($user_name, $user_email, $errors); return false; } $result = nxtmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']); extract($result); if ($errors->get_error_code()) { signup_blog($user_name, $user_email, $blogname, $blog_title, $errors); return false; } $public = (int) $_POST['blog_public']; $meta = array('lang_id' => 1, 'public' => $public); $meta = apply_filters('add_signup_meta', $meta); nxtmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta); return true; }
$user_id = add_user(); if (is_nxt_error($user_id)) { $add_user_errors = $user_id; } else { if (current_user_can('edit_users')) { $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); $redirect = 'users.php?usersearch=' . urlencode($new_user_login) . '&update=add' . '#user-' . $user_id; } else { $redirect = add_query_arg('update', 'add', 'user-new.php'); } nxt_redirect($redirect); die; } } else { // Adding a new user to this blog $user_details = nxtmu_validate_user_signup($_REQUEST['user_login'], $_REQUEST['email']); unset($user_details['errors']->errors['user_email_used']); if (is_nxt_error($user_details['errors']) && !empty($user_details['errors']->errors)) { $add_user_errors = $user_details['errors']; } else { $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true)); if (isset($_POST['noconfirmation']) && is_super_admin()) { add_filter('nxtmu_signup_user_notification', '__return_false'); // Disable confirmation email } nxtmu_signup_user($new_user_login, $_REQUEST['email'], array('add_to_blog' => $nxtdb->blogid, 'new_role' => $_REQUEST['role'])); if (isset($_POST['noconfirmation']) && is_super_admin()) { $key = $nxtdb->get_var($nxtdb->prepare("SELECT activation_key FROM {$nxtdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST['email'])); nxtmu_activate_signup($key); $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php'); } else {