/** * Validates the user input and registers the * user, called at uf_perform_register_edit() * * @return void */ function uf_validate_user_signup() { // set user mail $_POST['user_name'] = $_POST['user_login']; $_POST['user_email'] = $_POST['email']; // validate $result = uf_validate_user_form(); extract($result); if ($errors->get_error_code()) { wp_safe_redirect(home_url('/user-register/?message=' . $errors->get_error_code())); exit; } else { $_POST['add_to_blog'] = get_current_blog_id(); $_POST['new_role'] = 'subscriber'; wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', $_POST)); wp_safe_redirect(home_url('/user-login/?message=registered')); exit; } }
/** * Validate the new user signup * * @since MU * * @return bool True if new user signup was validated, false if error */ function validate_user_signup() { $result = validate_user_form(); $user_name = $result['user_name']; $user_email = $result['user_email']; $errors = $result['errors']; if ($errors->get_error_code()) { signup_user($user_name, $user_email, $errors); return false; } if ('blog' == $_POST['signup_for']) { signup_blog($user_name, $user_email); return false; } /** This filter is documented in wp-signup.php */ wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array())); confirm_user_signup($user_name, $user_email); return true; }
/** * Creates user without email confirmation. * * @access public */ public function custom_createuser() { global $wpdb; check_admin_referer('create-user', '_wpnonce_create-user'); if (!current_user_can('create_users')) { wp_die(__('Cheatin’ uh?')); } if (!is_multisite()) { $user_id = edit_user(); if (is_wp_error($user_id)) { $add_user_errors = $user_id; } else { 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 { /* Check if user already exists in the network */ $user_details = get_user_by('login', $_REQUEST['user_login']); if (!$user_details) { // Adding a new user to this site $user_details = wpmu_validate_user_signup($_REQUEST['user_login'], $_REQUEST['email']); if (is_wp_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(wp_unslash($_REQUEST['user_login']), true)); add_filter('wpmu_signup_user_notification', '__return_false'); // Disable confirmation email wpmu_signup_user($new_user_login, $_REQUEST['email'], array('add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'])); $key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST['email'])); wpmu_activate_signup($key); $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php'); wp_redirect($redirect); die; } } else { //Add existing user to the blog. $new_user_email = $user_details->user_email; $redirect = 'user-new.php'; $username = $user_details->user_login; $user_id = $user_details->ID; add_existing_user_to_blog(array('user_id' => $user_id, 'role' => $_REQUEST['role'])); $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php'); wp_redirect($redirect); die; } } }
function bp_core_signup_user($user_login, $user_password, $user_email, $usermeta) { global $bp, $wpdb; // Multisite installs have their own install procedure if (is_multisite()) { wpmu_signup_user($user_login, $user_email, $usermeta); // On multisite, the user id is not created until the user activates the account // but we need to cast $user_id to pass to the filters $user_id = false; } else { $errors = new WP_Error(); $user_id = wp_insert_user(array('user_login' => $user_login, 'user_pass' => $user_password, 'display_name' => sanitize_title($user_login), 'user_email' => $user_email)); if (empty($user_id)) { $errors->add('registerfail', sprintf(__('<strong>ERROR</strong>: Couldn’t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'buddypress'), get_option('admin_email'))); return $errors; } // Update the user status to '2' which we will use as 'not activated' (0 = active, 1 = spam, 2 = not active) $wpdb->query($wpdb->prepare("UPDATE {$wpdb->users} SET user_status = 2 WHERE ID = %d", $user_id)); // Set any profile data if (bp_is_active('xprofile')) { if (!empty($usermeta['profile_field_ids'])) { $profile_field_ids = explode(',', $usermeta['profile_field_ids']); foreach ((array) $profile_field_ids as $field_id) { if (empty($usermeta["field_{$field_id}"])) { continue; } $current_field = $usermeta["field_{$field_id}"]; xprofile_set_field_data($field_id, $user_id, $current_field); } } } } $bp->signup->username = $user_login; /*** * Now generate an activation key and send an email to the user so they can activate their account * and validate their email address. Multisite installs send their own email, so this is only for single blog installs. * * To disable sending activation emails you can user the filter 'bp_core_signup_send_activation_key' and return false. */ if (apply_filters('bp_core_signup_send_activation_key', true)) { if (!is_multisite()) { $activation_key = wp_hash($user_id); update_user_meta($user_id, 'activation_key', $activation_key); bp_core_signup_send_validation_email($user_id, $user_email, $activation_key); } } do_action('bp_core_signup_user', $user_id, $user_login, $user_password, $user_email, $usermeta); return $user_id; }
function bp_core_signup_validate_user_signup() { $result = bp_core_signup_validate_user_form(); extract($result); if ($errors->get_error_code()) { bp_core_signup_signup_user($user_name, $user_email, $errors); return false; } if ('blog' == $_POST['signup_for']) { bp_core_signup_signup_blog($user_name, $user_email); return false; } wpmu_signup_user($user_name, $user_email, apply_filters("add_signup_meta", array())); bp_core_signup_confirm_user_signup($user_name, $user_email); return true; }
/** * Displays the registration page * * @since 6.1 * @access public * * @param object $template Theme_My_Login_Template object */ public function tml_display_register(&$template) { global $wpdb, $blogname, $blog_title, $domain, $path, $active_signup; $theme_my_login = Theme_My_Login::get_object(); do_action('before_signup_form'); echo '<div class="login mu_register" id="theme-my-login' . esc_attr($template->get_option('instance')) . '">'; $active_signup = get_site_option('registration'); if (!$active_signup) { $active_signup = 'all'; } $active_signup = apply_filters('wpmu_active_signup', $active_signup); // return "all", "none", "blog" or "user" // Make the signup type translatable. $i18n_signup['all'] = _x('all', 'Multisite active signup type'); $i18n_signup['none'] = _x('none', 'Multisite active signup type'); $i18n_signup['blog'] = _x('blog', 'Multisite active signup type'); $i18n_signup['user'] = _x('user', 'Multisite active signup type'); if (is_super_admin()) { echo '<p class="message">' . sprintf(__('Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your <a href="%s">Options page</a>.', 'theme-my-login'), $i18n_signup[$active_signup], esc_url(network_admin_url('ms-options.php'))) . '</p>'; } $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null; $current_user = wp_get_current_user(); if ($active_signup == "none") { _e('Registration has been disabled.', 'theme-my-login'); } elseif ($active_signup == 'blog' && !is_user_logged_in()) { printf(__('You must first <a href="%s">log in</a>, and then you can create a new site.', 'theme-my-login'), wp_login_url(Theme_My_Login_Common::get_current_url())); } else { $stage = isset($_POST['stage']) ? $_POST['stage'] : 'default'; switch ($stage) { case 'validate-user-signup': if ($active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user') { $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); extract($result); $theme_my_login->errors = $errors; if ($errors->get_error_code()) { $this->signup_user($user_name, $user_email); break; } if ('blog' == $_POST['signup_for']) { $this->signup_blog($user_name, $user_email); break; } wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array())); ?> <h2><?php printf(__('%s is your new username', 'theme-my-login'), $user_name); ?> </h2> <p><?php _e('But, before you can start using your new username, <strong>you must activate it</strong>.', 'theme-my-login'); ?> </p> <p><?php printf(__('Check your inbox at <strong>%1$s</strong> and click the link given.', 'theme-my-login'), $user_email); ?> </p> <p><?php _e('If you do not activate your username within two days, you will have to sign up again.', 'theme-my-login'); ?> </p> <?php do_action('signup_finished'); } else { _e('User registration has been disabled.', 'theme-my-login'); } break; case 'validate-blog-signup': if ($active_signup == 'all' || $active_signup == 'blog') { // Re-validate user info. $result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']); extract($result); $theme_my_login->errors = $errors; if ($errors->get_error_code()) { $this->signup_user($user_name, $user_email); break; } $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']); extract($result); $theme_my_login->errors = $errors; if ($errors->get_error_code()) { $this->signup_blog($user_name, $user_email, $blogname, $blog_title); break; } $public = (int) $_POST['blog_public']; $meta = array('lang_id' => 1, 'public' => $public); $meta = apply_filters('add_signup_meta', $meta); wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta); ?> <h2><?php printf(__('Congratulations! Your new site, %s, is almost ready.', 'theme-my-login'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>"); ?> </h2> <p><?php _e('But, before you can start using your site, <strong>you must activate it</strong>.', 'theme-my-login'); ?> </p> <p><?php printf(__('Check your inbox at <strong>%s</strong> and click the link given.', 'theme-my-login'), $user_email); ?> </p> <p><?php _e('If you do not activate your site within two days, you will have to sign up again.', 'theme-my-login'); ?> </p> <h2><?php _e('Still waiting for your email?', 'theme-my-login'); ?> </h2> <p> <?php _e('If you haven’t received your email yet, there are a number of things you can do:', 'theme-my-login'); ?> <ul id="noemail-tips"> <li><p><strong><?php _e('Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.', 'theme-my-login'); ?> </strong></p></li> <li><p><?php _e('Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.', 'theme-my-login'); ?> </p></li> <li><?php printf(__('Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.', 'theme-my-login'), $user_email); ?> </li> </ul> </p> <?php do_action('signup_finished'); } else { _e('Site registration has been disabled.', 'theme-my-login'); } break; case 'gimmeanotherblog': $current_user = wp_get_current_user(); if (!is_user_logged_in()) { die; } $result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $current_user); extract($result); $theme_my_login->errors = $errors; if ($errors->get_error_code()) { $this->signup_another_blog($blogname, $blog_title); break; } $public = (int) $_POST['blog_public']; $meta = apply_filters('signup_create_blog_meta', array('lang_id' => 1, 'public' => $public)); // deprecated $meta = apply_filters('add_signup_meta', $meta); wpmu_create_blog($domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid); ?> <h2><?php printf(__('The site %s is yours.', 'theme-my-login'), "<a href='http://{$domain}{$path}'>{$blog_title}</a>"); ?> </h2> <p> <?php printf(__('<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as “%4$s” using your existing password.', 'theme-my-login'), $domain . $path, $domain . $path, "http://" . $domain . $path . "wp-login.php", $current_user->user_login); ?> </p> <?php do_action('signup_finished'); break; case 'default': default: $user_email = isset($_POST['user_email']) ? $_POST['user_email'] : ''; do_action('preprocess_signup_form'); // populate the form from invites, elsewhere? if (is_user_logged_in() && ($active_signup == 'all' || $active_signup == 'blog')) { $this->signup_another_blog($newblogname); } elseif (is_user_logged_in() == false && ($active_signup == 'all' || $active_signup == 'user')) { $this->signup_user($newblogname, $user_email); } elseif (is_user_logged_in() == false && $active_signup == 'blog') { _e('Sorry, new registrations are not allowed at this time.', 'theme-my-login'); } else { _e('You are logged in already. No need to register again!', 'theme-my-login'); } if ($newblogname) { $newblog = get_blogaddress_by_name($newblogname); if ($active_signup == 'blog' || $active_signup == 'all') { printf(__('<p><em>The site you were looking for, <strong>%s</strong> does not exist, but you can create it now!</em></p>', 'theme-my-login'), $newblog); } else { printf(__('<p><em>The site you were looking for, <strong>%s</strong>, does not exist.</em></p>', 'theme-my-login'), $newblog); } } break; } } echo '</div>'; do_action('after_signup_form'); }
public function signup_form_shortcode($atts, $content = NULL, $tag = '') { global $current_site; if (!is_multisite()) { return $content; } if (is_page()) { $this->signup_form_page = get_page_link(); // add_filter( 'wpmu_signup_user_notification_email', array( $this, 'wpmu_signup_user_notification_email' ), 10, 5 ); add_filter('site_url', array($this, 'site_url'), 10, 4); } $args = shortcode_atts(array('class' => 'member-signup', 'title' => sprintf(__('Get your own %s account in seconds'), $current_site->site_name), 'title_wrap' => 'h3', 'field_wrap' => 'div', 'field_wrap_class' => 'member-signup-field', 'logged_in_redirect' => false, 'logged_in_text' => __('You are logged in already. No need to register again!'), 'disabled_redirect' => false, 'disabled_text' => __('Registration has been disabled.')), $atts, $tag); $labels = apply_filters('gmember_signup_form_labels', array('user_name' => __('Username:'******'user_email' => __('Email Address:'), 'user_pass' => __('Password:'******'submit' => __('Submit')), $args); $descriptions = apply_filters('gmember_signup_form_descriptions', array('user_name' => __('(Must be at least 4 characters, letters and numbers only.)'), 'user_email' => __('We send your registration email to this address. (Double-check your email address before continuing.)')), $args); if (isset($_GET['key']) || isset($_POST['key'])) { $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key']; $current = wpmu_activate_signup($key); if (is_wp_error($current)) { if ('already_active' == $current->get_error_code() || 'blog_taken' == $current->get_error_code()) { $signup = $current->get_error_data(); $activate = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title member-signup-activate-title'), __('Your account is now active!')); $activate .= gPluginHTML::tag('p', array('class' => 'lead-in member-signup-activate-text'), '' == $signup->domain . $signup->path ? sprintf(__('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url('wp-login.php', 'login'), $signup->user_login, $signup->user_email, wp_lostpassword_url()) : sprintf(__('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url())); defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true); return gPluginHTML::tag('div', array('class' => $args['class'] . ' member-signup-activate'), $activate); } else { $activate = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title member-signup-activate-title member-signup-activate-error-title'), __('An error occurred during the activation')); $activate .= gPluginHTML::tag('p', array('class' => 'member-signup-activate-error-text'), $current->get_error_message()); defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true); return gPluginHTML::tag('div', array('class' => $args['class'] . ' member-signup-activate-error'), $activate); } } else { $user = get_userdata((int) $current['user_id']); $activate = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title member-signup-activate-title'), __('Your account is now active!')); $welcome = '<p>' . gPluginHTML::tag('span', array('class' => 'h3'), $labels['user_name']); $welcome .= gPluginHTML::tag('span', array(), $user->user_login) . '</p>'; $welcome .= '<p>' . gPluginHTML::tag('span', array('class' => 'h3'), $labels['user_pass']); $welcome .= gPluginHTML::tag('span', array(), $current['password']) . '</p>'; $activate .= gPluginHTML::tag('div', array('id' => 'signup-welcome', 'class' => 'member-signup-activate-welcome'), $welcome); $url = get_blogaddress_by_id((int) $current['blog_id']); $activate .= gPluginHTML::tag('p', array('class' => 'view member-signup-activate-text'), $url != network_home_url('', 'http') ? sprintf(__('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php') : sprintf(__('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.'), network_site_url('wp-login.php', 'login'), network_home_url())); defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true); return gPluginHTML::tag('div', array('class' => $args['class'] . ' member-signup-activate'), $activate); } } if (is_user_logged_in()) { if ($args['logged_in_redirect']) { wp_redirect($args['logged_in_redirect']); die; } else { $logged_in = gPluginHTML::tag('p', array('class' => 'member-signup-logged-in'), $args['logged_in_text']); return gPluginHTML::tag('div', array('class' => $args['class']), $logged_in); } } $active_signup = apply_filters('wpmu_active_signup', get_site_option('registration', 'all')); // return "all", "none", "blog" or "user" if ($active_signup == 'none') { if ($args['disabled_redirect']) { wp_redirect($args['disabled_redirect']); die; } else { $disabled = gPluginHTML::tag('p', array('class' => 'member-signup-disabled'), $args['logged_disabled']); return gPluginHTML::tag('div', array('class' => $args['class']), $disabled); } } $current = array('stage' => isset($_POST['stage']) ? $_POST['stage'] : 'default', 'user_name' => isset($_POST['user_name']) ? $_POST['user_name'] : '', 'user_email' => isset($_POST['user_email']) ? $_POST['user_email'] : '', 'errors' => new WP_Error()); switch ($current['stage']) { case 'validate-user-signup': // removed beacause: the filter not checked wp nounce if its not on wp-signup.php and wp_die is not acceptable! remove_filter('wpmu_validate_user_signup', 'signup_nonce_check'); if (wp_create_nonce('member_signup_form_' . $_POST['member_signup_form_id']) != $_POST['_member_signup_form']) { $error = gPluginHTML::tag('p', array('class' => 'member-signup-error'), __('Please try again.')); defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true); return gPluginHTML::tag('div', array('class' => $args['class']), $error); } $current = array_merge($current, wpmu_validate_user_signup($current['user_name'], $current['user_email'])); //$result = array('user_name' => $user_name, 'orig_username' => $orig_username, 'user_email' => $user_email, 'errors' => $errors); if (!$current['errors']->get_error_code()) { wpmu_signup_user($current['user_name'], $current['user_email'], apply_filters('add_signup_meta', array())); $confirm = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title member-signup-title-confirm'), sprintf(__('%s is your new username'), $current['user_name'])); $confirm .= gPluginHTML::tag('p', array(), __('But, before you can start using your new username, <strong>you must activate it</strong>.')); $confirm .= gPluginHTML::tag('p', array(), sprintf(__('Check your inbox at <strong>%s</strong> and click the link given.'), $current['user_email'])); $confirm .= gPluginHTML::tag('p', array(), __('If you do not activate your username within two days, you will have to sign up again.')); ob_start(); do_action('signup_finished'); $confirm .= ob_get_clean(); defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true); return gPluginHTML::tag('div', array('class' => $args['class'] . ' member-signup-confirm'), $confirm); } } $current = apply_filters('signup_user_init', $current); // allow definition of default variables ob_start(); do_action('preprocess_signup_form'); $pre = ob_get_clean(); $header = gPluginHTML::tag($args['title_wrap'], array('class' => 'member-signup-title'), $args['title']); $fields_hidden = gPluginHTML::tag('input', array('type' => 'hidden', 'name' => 'stage', 'value' => 'validate-user-signup'), false); remove_action('signup_hidden_fields', 'signup_nonce_fields'); $id_nonce = mt_rand(); $fields_hidden .= gPluginHTML::tag('input', array('type' => 'hidden', 'name' => 'member_signup_form_id', 'value' => $id_nonce), false); $fields_hidden .= wp_nonce_field('member_signup_form_' . $id_nonce, '_member_signup_form', false, false); ob_start(); do_action('signup_hidden_fields'); $fields_hidden .= ob_get_clean(); $field_user_name = gPluginHTML::tag('label', array('for' => 'user_name'), $labels['user_name']); if ($username_error = $current['errors']->get_error_message('user_name')) { $field_user_name .= gPluginHTML::tag('p', array('class' => 'error'), $username_error); } $field_user_name .= gPluginHTML::tag('input', array('name' => 'user_name', 'id' => 'user_name', 'class' => 'textInput', 'type' => 'text', 'value' => esc_attr($current['user_name']), 'maxlength' => '60'), false); if ($descriptions['user_name']) { $field_user_name .= gPluginHTML::tag('p', array('class' => 'description formHint'), $descriptions['user_name']); } $field_user_name = gPluginHTML::tag($args['field_wrap'], array('class' => $args['field_wrap_class'] . ' ctrlHolder'), $field_user_name); $field_user_email = gPluginHTML::tag('label', array('for' => 'user_email'), $labels['user_email']); if ($useremail_error = $current['errors']->get_error_message('user_email')) { $field_user_email .= gPluginHTML::tag('p', array('class' => 'error'), $useremail_error); } $field_user_email .= gPluginHTML::tag('input', array('name' => 'user_email', 'id' => 'user_email', 'class' => 'textInput', 'type' => 'text', 'value' => esc_attr($current['user_email']), 'maxlength' => '200'), false); if ($descriptions['user_email']) { $field_user_email .= gPluginHTML::tag('p', array('class' => 'description formHint'), $descriptions['user_email']); } $field_user_email = gPluginHTML::tag($args['field_wrap'], array('class' => $args['field_wrap_class'] . ' ctrlHolder'), $field_user_email); $user_email = gPluginHTML::tag('fieldset', array(), $field_user_name . $field_user_email); ob_start(); do_action('signup_extra_fields', $current['errors'], $args); $fields_extra = ob_get_clean(); $submit = gPluginHTML::tag('input', array('name' => 'submit', 'class' => 'primaryAction', 'type' => 'submit', 'value' => esc_attr($labels['submit'])), false); $submit = gPluginHTML::tag('p', array('class' => 'submit buttonHolder'), $submit); $form = gPluginHTML::tag('form', array('id' => 'member_signup_form', 'method' => 'post', 'class' => 'uniForm', 'action' => ''), $fields_hidden . $user_email . $fields_extra . $submit); defined('DONOTCACHEPAGE') or define('DONOTCACHEPAGE', true); return gPluginHTML::tag('div', array('class' => $args['class']), $pre . $header . $form); }
public static function gf_create_user($entry, $form, $fulfilled = false) { self::log_debug("form #{$form['id']} - starting gf_create_user()."); global $wpdb; // if the entry is marked as spam if (rgar($entry, 'status') == 'spam') { self::log_debug('gf_create_user(): aborting. Entry is marked as spam.'); return; } $config = self::get_active_config($form, $entry); $is_update_feed = rgars($config, 'meta/feed_type') == 'update'; // if there is no registration feed or the feed is not active, abandon ship if (!$config || !$config['is_active']) { self::log_debug('gf_create_user(): aborting. No feed or feed is inactive.'); return; } $user_data = self::get_user_data($entry, $form, $config, $is_update_feed); if (!$user_data) { self::log_debug('gf_create_user(): aborting. user_login or user_email are empty.'); return; } // if PayPal Add-on was used for this entry, integrate $paypal_config = self::get_paypal_config($form["id"], $entry); $delay_paypal_registration = 0; $password = ''; if ($paypal_config) { $order_total = GFCommon::get_order_total($form, $entry); // delay the registration IF: // - the delay registration option is checked // - the order total does NOT equal zero (no delay since there will never be a payment) // - the payment has not already been fulfilled $delay_paypal_registration = $paypal_config['meta']['delay_registration']; if ($paypal_config && $delay_paypal_registration && $order_total != 0 && !$fulfilled) { self::log_debug('gf_create_user(): aborting. Registration delayed by PayPal feed configuration.'); //Saving encrypted password in meta gform_update_meta($entry['id'], 'userregistration_password', self::encrypt($user_data['password'])); return; } else { if ($paypal_config && $delay_paypal_registration && $order_total != 0 && $fulfilled) { //reading encrypted password from meta and removing meta $password = gform_get_meta($entry['id'], 'userregistration_password'); if ($password) { $password = self::decrypt($password); gform_delete_meta($entry['id'], 'userregistration_password'); } } } } // provide filter to allow add-ons to disable registration if needed $disable_registration = apply_filters('gform_disable_registration', false, $form, $entry, $fulfilled); if ($disable_registration) { self::log_debug('gf_create_user(): aborting. gform_disable_registration hook was used.'); return; } $user_activation = rgars($config, 'meta/user_activation'); // if about to create user, check if activation required... only use activation if payment is not fulfilled by payment //if manual activation and paypal set to delay registration and paypal fulfilled, need to put in signups table if (!$is_update_feed && $user_activation && !$fulfilled || !$is_update_feed && $user_activation && $fulfilled && $delay_paypal_registration) { require_once self::get_base_path() . '/includes/signups.php'; GFUserSignups::prep_signups_functionality(); $meta = array('lead_id' => $entry['id'], 'user_login' => $user_data['user_login'], 'email' => $user_data['user_email'], 'password' => self::encrypt($user_data['password'])); $meta = apply_filters('gform_user_registration_signup_meta', $meta, $form, $entry, $config); $meta = apply_filters("gform_user_registration_signup_meta_{$form['id']}", $meta, $form, $entry, $config); $ms_options = rgars($config, 'meta/multisite_options'); // save current user details in wp_signups for future activation if (is_multisite() && rgar($ms_options, 'create_site') && ($site_data = self::get_site_data($entry, $form, $config))) { wpmu_signup_blog($site_data['domain'], $site_data['path'], $site_data['title'], $user_data['user_login'], $user_data['user_email'], $meta); } else { // wpmu_signup_user() does the following sanitization of the user_login before saving it to the database, // we can run this same code here to allow successful retrievel of the activation_key without actually // changing the user name when it is activated. 'd smith' => 'dsmith', but when activated, username is 'd smith'. $user_data['user_login'] = preg_replace('/\\s+/', '', sanitize_user($user_data['user_login'], true)); self::log_debug("Calling wpmu_signup_user (sends email with activation link) with login: "******" email: " . $user_data['user_email'] . " meta: " . print_r($meta, true)); wpmu_signup_user($user_data['user_login'], $user_data['user_email'], $meta); self::log_debug("Done with wpmu_signup_user"); } $activation_key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s ORDER BY registered DESC LIMIT 1", $user_data['user_login'])); // used for filtering on activation listing UI GFUserSignups::add_signup_meta($entry['id'], $activation_key); // abort current sign up, user must activate return; } if ($is_update_feed) { self::update_user($entry, $form, $config); } else { //only run create_user when manual/email activation NOT set if (!$user_activation) { self::log_debug("in gf_create_user - calling create_user"); self::create_user($entry, $form, $config, $password); } } }
/** * Process data submitted at user registration and convert to a signup object. * * @since 1.2.0 * * @todo There appears to be a bug in the return value on success. * * @param string $user_login Login name requested by the user. * @param string $user_password Password requested by the user. * @param string $user_email Email address entered by the user. * @param array $usermeta Miscellaneous metadata about the user (blog-specific * signup data, xprofile data, etc). * @return bool|WP_Error True on success, WP_Error on failure. */ function bp_core_signup_user($user_login, $user_password, $user_email, $usermeta) { $bp = buddypress(); // We need to cast $user_id to pass to the filters. $user_id = false; // Multisite installs have their own install procedure. if (is_multisite()) { wpmu_signup_user($user_login, $user_email, $usermeta); } else { // Format data. $user_login = preg_replace('/\\s+/', '', sanitize_user($user_login, true)); $user_email = sanitize_email($user_email); $activation_key = wp_generate_password(32, false); /** * WordPress's default behavior is to create user accounts * immediately at registration time. BuddyPress uses a system * borrowed from WordPress Multisite, where signups are stored * separately and accounts are only created at the time of * activation. For backward compatibility with plugins that may * be anticipating WP's default behavior, BP silently creates * accounts for registrations (though it does not use them). If * you know that you are not running any plugins dependent on * these pending accounts, you may want to save a little DB * clutter by defining setting the BP_SIGNUPS_SKIP_USER_CREATION * to true in your wp-config.php file. */ if (!defined('BP_SIGNUPS_SKIP_USER_CREATION') || !BP_SIGNUPS_SKIP_USER_CREATION) { $user_id = BP_Signup::add_backcompat($user_login, $user_password, $user_email, $usermeta); if (is_wp_error($user_id)) { return $user_id; } bp_update_user_meta($user_id, 'activation_key', $activation_key); } $args = array('user_login' => $user_login, 'user_email' => $user_email, 'activation_key' => $activation_key, 'meta' => $usermeta); BP_Signup::add($args); /** * Filters if BuddyPress should send an activation key for a new signup. * * @since 1.2.3 * * @param bool $value Whether or not to send the activation key. * @param int $user_id User ID to send activation key to. * @param string $user_email User email to send activation key to. * @param string $activation_key Activation key to be sent. * @param array $usermeta Miscellaneous metadata about the user (blog-specific * signup data, xprofile data, etc). */ if (apply_filters('bp_core_signup_send_activation_key', true, $user_id, $user_email, $activation_key, $usermeta)) { bp_core_signup_send_validation_email($user_id, $user_email, $activation_key, $user_login); } } $bp->signup->username = $user_login; /** * Fires at the end of the process to sign up a user. * * @since 1.2.2 * * @param bool|WP_Error $user_id True on success, WP_Error on failure. * @param string $user_login Login name requested by the user. * @param string $user_password Password requested by the user. * @param string $user_email Email address requested by the user. * @param array $usermeta Miscellaneous metadata about the user (blog-specific * signup data, xprofile data, etc). */ do_action('bp_core_signup_user', $user_id, $user_login, $user_password, $user_email, $usermeta); return $user_id; }
function validate_user_signup() { $result = validate_user_form(); extract($result); // list_hooked_functions(); if ($errors->get_error_code()) { signup_user($user_name, $user_email, $errors); return false; } if ('blog' == $_POST['signup_for']) { signup_blog($user_name, $user_email); return false; } echo "<h1>" . $user_email . "</h1>"; wpmu_signup_user($user_name, $user_email, apply_filters("add_signup_meta", array())); confirm_user_signup($user_name, $user_email); return true; }
public function register() { $this->validate(); // split incoming data and keep the stuff we can pass to // update_user_meta. Set the user's password as meta so that we don't // haveto ask the user for it again after activation. $this->user_meta = array_merge(array_diff_assoc($this->attributes, parse_user($this->attributes)), array('user_pass' => wp_hash_password($this->user_pass))); wpmu_signup_user($this->user_login, $this->user_email, $this->user_meta); }
/** * Registers a new user. Supports multisite. */ public function register() { if (!get_option('users_can_register')) { $error = new WP_Error(); $error->add('users_cannot_register', __('Registration is not enabled for this site.')); return $error; } $user_name = $_POST['user_name']; $user_email = $_POST['user_email']; if (empty($user_name) || empty($user_email)) { $errors = new WP_Error(); if (empty($user_name)) { $errors->add('username_required', __("A username is required.")); } if (empty($user_email)) { $errors->add('email_required', __("A email is required.")); } return $errors; } $result = wpmu_validate_user_signup($user_name, $user_email); extract($result); if ($errors->get_error_code()) { return $errors; } /** This filter is documented in wp-signup.php */ $meta = apply_filters('add_signup_meta', array()); // this also sends out email if (is_multisite()) { // Note: filters and admin options can prevent the email from being sent // but the user will still be signed up // this call was taking up to a minute!!! // update- a lot of calls were taking a while - not sure what is going on $emailSent = wpmu_signup_user($user_name, $user_email, $meta); $user = get_user_by('login', $user_name); $userId = $user ? $user->ID : -1; // seems to be null?? } else { $userId = register_new_user($user_name, $user_email); } if (is_wp_error($result)) { return $result; } $result = array('status' => 'ok', 'user_name' => $user_name, 'user_email' => $user_email, 'created' => (bool) true); // multisite call returns -1 so not consistent // i'm guessing user must activate their account to get an id //if ($userId!=-1) { // $result['id'] = $userId; //} return $result; }
/** * Update the $wpdb->signups table in case of a multisite config * * @package WP Idea Stream * @subpackage users/functions * * @since 2.2.0 * * @global $wpdb * @param array $signup the signup required data * @param int $user_id the user ID * @uses wp_idea_stream_users_get_user_data() to get user data */ function wp_idea_stream_users_update_signups_table($user_id = 0) { global $wpdb; if (empty($user_id)) { return; } $user = wp_idea_stream_users_get_user_data('id', $user_id); if (empty($user->user_login) || empty($user->user_email)) { return; } add_filter('wpmu_signup_user_notification', 'wp_idea_stream_users_intercept_activation_key', 10, 4); wpmu_signup_user($user->user_login, $user->user_email, array('add_to_blog' => get_current_blog_id(), 'new_role' => wp_idea_stream_users_get_default_role())); remove_filter('wpmu_signup_user_notification', 'wp_idea_stream_users_intercept_activation_key', 10, 4); $key = wp_idea_stream_get_idea_var('activation_key'); if (empty($key[$user->user_email])) { return; // Reset the global } else { wp_idea_stream_set_idea_var('activation_key', array()); } $wpdb->update($wpdb->signups, array('active' => 1, 'activated' => current_time('mysql', true)), array('activation_key' => $key[$user->user_email])); }
public function test_should_not_fail_for_existing_signup_with_same_email_if_signup_is_old() { // Don't send notifications. add_filter( 'wpmu_signup_user_notification', '__return_true' ); wpmu_signup_user( 'foo123', '*****@*****.**' ); remove_filter( 'wpmu_signup_user_notification', '__return_true' ); global $wpdb; $date = date( 'Y-m-d H:i:s', time() - ( 2 * DAY_IN_SECONDS ) - 60 ); $wpdb->update( $wpdb->signups, array( 'registered' => $date ), array( 'user_login' => 'foo123' ) ); $v = wpmu_validate_user_signup( 'foo2', '*****@*****.**' ); $this->assertNotContains( 'user_email', $v['errors']->get_error_codes() ); }
/** * Process data submitted at user registration and convert to a signup object. * * @todo There appears to be a bug in the return value on success. * * @param string $user_login Login name requested by the user. * @param string $user_password Password requested by the user. * @param string $user_email Email address entered by the user. * @param array $usermeta Miscellaneous metadata about the user (blog-specific * signup data, xprofile data, etc). * @return bool|WP_Error True on success, WP_Error on failure. */ function bp_core_signup_user($user_login, $user_password, $user_email, $usermeta) { $bp = buddypress(); // We need to cast $user_id to pass to the filters $user_id = false; // Multisite installs have their own install procedure if (is_multisite()) { wpmu_signup_user($user_login, $user_email, $usermeta); } else { // Format data $user_login = preg_replace('/\\s+/', '', sanitize_user($user_login, true)); $user_email = sanitize_email($user_email); $activation_key = substr(md5(time() . rand() . $user_email), 0, 16); /** * WordPress's default behavior is to create user accounts * immediately at registration time. BuddyPress uses a system * borrowed from WordPress Multisite, where signups are stored * separately and accounts are only created at the time of * activation. For backward compatibility with plugins that may * be anticipating WP's default behavior, BP silently creates * accounts for registrations (though it does not use them). If * you know that you are not running any plugins dependent on * these pending accounts, you may want to save a little DB * clutter by defining setting the BP_SIGNUPS_SKIP_USER_CREATION * to true in your wp-config.php file. */ if (!defined('BP_SIGNUPS_SKIP_USER_CREATION') || !BP_SIGNUPS_SKIP_USER_CREATION) { $user_id = BP_Signup::add_backcompat($user_login, $user_password, $user_email, $usermeta); if (is_wp_error($user_id)) { return $user_id; } $activation_key = wp_hash($user_id); update_user_meta($user_id, 'activation_key', $activation_key); } $args = array('user_login' => $user_login, 'user_email' => $user_email, 'activation_key' => $activation_key, 'meta' => $usermeta); BP_Signup::add($args); if (apply_filters('bp_core_signup_send_activation_key', true, $user_id, $user_email, $activation_key, $usermeta)) { bp_core_signup_send_validation_email($user_id, $user_email, $activation_key); } } $bp->signup->username = $user_login; do_action('bp_core_signup_user', $user_id, $user_login, $user_password, $user_email, $usermeta); return $user_id; }
/** * Maybe add a child from the "Children" section * * @since 0.1.0 */ function wp_user_parents_add_child() { // Bail if no signup nonce if (empty($_REQUEST['signup_nonce'])) { return; } // Bail if nonce fails if (!wp_verify_nonce($_REQUEST['signup_nonce'], 'wp_user_dashboard_child_signup')) { return; } // Bail if current user cannot have children if (!current_user_can('have_user_children')) { return; } // Sanitize fields $redirect = false; $email = sanitize_email($_REQUEST['email']); $firstname = !empty($_REQUEST['firstname']) ? $_REQUEST['firstname'] : ''; $lastname = !empty($_REQUEST['lastname']) ? $_REQUEST['lastname'] : ''; $password = !empty($_REQUEST['password']) ? $_REQUEST['password'] : wp_generate_password(12, false); $username = !empty($_REQUEST['username']) ? $_REQUEST['username'] : "******"; // Names are empty if (empty($firstname) || empty($lastname) || strlen($firstname) < 2 || strlen($lastname) < 2) { $args = array('error' => 'name'); $url = wp_get_user_dashboard_url('children'); $redirect = add_query_arg($args, $url); } // Username exists if (username_exists($username) || strlen($username) < 4) { $args = array('error' => 'username'); $url = wp_get_user_dashboard_url('children'); $redirect = add_query_arg($args, $url); } // Email exists if (email_exists($email)) { $args = array('error' => 'username'); $url = wp_get_user_dashboard_url('children'); $redirect = add_query_arg($args, $url); } // Redirect if (!empty($redirect)) { wp_safe_redirect($redirect); exit; } // Requires activation if (is_multisite() && apply_filters('wp_join_page_requires_activation', true)) { wpmu_signup_user($username, $email, array('add_to_blog' => get_current_blog_id(), 'new_role' => get_option('default_role'), 'first_name' => $firstname, 'last_name' => $lastname)); } // Create the user account $user_id = wpmu_create_user(esc_html(sanitize_key($username)), $password, $email); // Bail if no user ID for site if (empty($user_id)) { $args = array('error' => 'unknown'); $url = wp_get_user_dashboard_url('children'); $redirect = add_query_arg($args, $url); } // Get new userdata $user = new WP_User($user_id); $user->add_role('pending'); // Get the current user ID $current_user_id = get_current_user_id(); // Save fullname to usermeta update_user_meta($user->ID, 'first_name', $firstname); update_user_meta($user->ID, 'last_name', $lastname); add_user_meta($user->ID, 'user_parent', $current_user_id, false); // Do action do_action('wp_user_parents_added_child', $user, $current_user_id); // Redirect $args = array('success' => 'yay'); $url = wp_get_user_dashboard_url('children'); $redirect = add_query_arg($args, $url); wp_safe_redirect($redirect); die; }
public function rpr_preprocess_signup_form() { global $active_signup, $stage; switch ($stage) { case 'user-signup': if ($active_signup == 'all' || $_POST['signup_for'] == 'blog' && $active_signup == 'blog' || $_POST['signup_for'] == 'user' && $active_signup == 'user') { /* begin validate_user_signup stage */ // validate signup form, do wpmu_validate_user_signup action $result = wpmu_validate_user_signup(isset($_POST['user_name']) ? (string) $_POST['user_name'] : "", isset($_POST['user_email']) ? (string) $_POST['user_email'] : ""); extract($result); if ($errors->get_error_code()) { echo "signup_user"; signup_user($user_name, $user_email, $errors); do_action('after_signup_form'); get_footer(); exit; } if ('blog' === $_POST['signup_for']) { echo "signup_blog"; signup_blog($user_name, $user_email); do_action('after_signup_form'); get_footer(); exit; } // collect meta, commit user to database, send email wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array())); // previously, displayed confirm_user_signup message before signup_finished action do_action('signup_finished'); /* end validate_user_signup stage */ } else { _e('User registration has been disabled.'); ?> </div> </div> <?php do_action('after_signup_form'); get_footer(); exit; } break; case 'blog-signup': if ($active_signup == 'all' || $active_signup == 'blog') { /* begin validate_blog_signup stage */ $result = wpmu_validate_user_signup(isset($_POST['user_name']) ? (string) $_POST['user_name'] : "", isset($_POST['user_email']) ? (string) $_POST['user_email'] : ""); extract($result); if ($errors->get_error_code()) { echo "signup_user"; signup_user($user_name, $user_email, $errors); do_action('after_signup_form'); get_footer(); exit; } $result = wpmu_validate_blog_signup(isset($_POST['blogname']) ? (string) $_POST['blogname'] : "", isset($_POST['blog_title']) ? (string) $_POST['blog_title'] : ""); extract($result); if ($errors->get_error_code()) { signup_blog($user_name, $user_email, $blogname, $blog_title, $errors); do_action('after_signup_form'); get_footer(); exit; } // collect meta, commit user to database, send email $meta = array('lang_id' => 1, 'public' => (int) $_POST['blog_public']); wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, apply_filters('add_signup_meta', $meta)); // previously, displayed confirm_blog_signup message before signup_finished action do_action('signup_finished'); /* end validate_blog_signup stage */ } else { _e('Site registration has been disabled.'); ?> </div> </div> <?php do_action('after_signup_form'); get_footer(); exit; } break; default: return; } /* begin wp-activate page */ $key = (string) $_REQUEST['key']; // wpmu_create_user, wpmu_welcome_user_notification, add_new_user_to_blog, do wpmu_activate_user action $result = wpmu_activate_signup($key); if (is_wp_error($result)) { if ('already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code()) { $signup = $result->get_error_data(); ?> <h2><?php _e('Your account is now active!'); ?> </h2> <?php echo '<p class="lead-in">'; if ($signup->domain . $signup->path == '') { printf(__('Your account has been activated. You may now <a href="%1$s">log in</a> to the site using your chosen username of “%2$s”. Please check your email inbox at %3$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%4$s">reset your password</a>.'), network_site_url('wp-login.php', 'login'), $signup->user_login, $signup->user_email, wp_lostpassword_url()); } else { printf(__('Your site at <a href="%1$s">%2$s</a> is active. You may now log in to your site using your chosen username of “%3$s”. Please check your email inbox at %4$s for your password and login instructions. If you do not receive an email, please check your junk or spam folder. If you still do not receive an email within an hour, you can <a href="%5$s">reset your password</a>.'), 'http://' . $signup->domain, $signup->domain, $signup->user_login, $signup->user_email, wp_lostpassword_url()); } echo '</p>'; } else { ?> <h2><?php _e('An error occurred during the activation'); ?> </h2> <?php echo '<p>' . $result->get_error_message() . '</p>'; } } else { //TODO: Why not reference $result->blog_id? extract($result); if (isset($blog_id)) { $url = get_blogaddress_by_id((int) $blog_id); } $user = get_userdata((int) $user_id); ?> <h2><?php _e('Your account is now active!'); ?> </h2> <div id="signup-welcome"> <p><span class="h3"><?php _e('Username:'******'Password:'******'', 'http')) { ?> <p class="view"><?php printf(__('Your account is now activated. <a href="%1$s">View your site</a> or <a href="%2$s">Log in</a>'), $url, $url . 'wp-login.php'); ?> </p> <?php } else { ?> <p class="view"><?php printf(__('Your account is now activated. <a href="%1$s">Log in</a> or go back to the <a href="%2$s">homepage</a>.'), network_site_url('wp-login.php', 'login'), network_home_url()); ?> </p> <?php } } ?> </div> <script type="text/javascript"> var key_input = document.getElementById('key'); key_input && key_input.focus(); </script> <?php get_footer(); ?> <?php exit; }
/** * Validate the new user signup * * @since MU * * @uses validate_user_form() to retrieve an array of the user data * @uses wpmu_signup_user() to signup the new user * @uses confirm_user_signup() to confirm the new user signup * @return bool True if new user signup was validated, false if error */ function validate_user_signup() { $result = validate_user_form(); extract($result); if ($errors->get_error_code()) { signup_user($user_name, $user_email, $errors); return false; } if ('blog' == $_POST['signup_for']) { signup_blog($user_name, $user_email); return false; } //duplicate_hook wpmu_signup_user($user_name, $user_email, apply_filters('add_signup_meta', array())); confirm_user_signup($user_name, $user_email); return true; }
function registration() { check_ajax_referer('cadastrar-usuario'); $userdata = array('user_login' => esc_attr($this->username), 'user_email' => esc_attr($this->email), 'user_nice_name' => esc_attr($this->nice_name), 'user_pass' => esc_attr($this->password), 'ref_url' => $this->ref_url); $json = array(); $validation = $this->validation(); if (is_wp_error($validation)) { $json['error'] = $validation->get_error_message(); } else { $user_meta = array('user_nice_name' => $userdata['user_nice_name'], 'user_pass' => wp_hash_password($userdata['user_pass']), 'ref_url' => $userdata['ref_url']); wpmu_signup_user($userdata['user_login'], $userdata['user_email'], $user_meta); $json['success'] = true; } return $json; }
if (is_wp_error($user_details['errors']) && !empty($user_details['errors']->errors)) { $add_user_errors = $user_details['errors']; } else { /** * Filter the user_login, also known as the username, before it is added to the site. * * @since 2.0.3 * * @param string $user_login The sanitized username. */ $new_user_login = apply_filters('pre_user_login', sanitize_user(wp_unslash($_REQUEST['user_login']), true)); if (isset($_POST['noconfirmation']) && is_super_admin()) { add_filter('wpmu_signup_user_notification', '__return_false'); // Disable confirmation email } wpmu_signup_user($new_user_login, $_REQUEST['email'], array('add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'])); if (isset($_POST['noconfirmation']) && is_super_admin()) { $key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $_REQUEST['email'])); wpmu_activate_signup($key); $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php'); } else { $redirect = add_query_arg(array('update' => 'newuserconfirmation'), 'user-new.php'); } wp_redirect($redirect); die; } } } $title = __('Add New User'); $parent_file = 'users.php'; $do_both = false;
/** * Push subscriber (non WP user) details * * * */ public function push_subscriber() { // get user data $email = $_POST['user_email']; $first_name = $_POST['first_name']; $last_name = $_POST['last_name']; // $name = $_POST['nationbuilder']['name']; // // explode name // if (strpos($name, ' ') !== false) { // $name_array = explode(' ', $name); // $first_name = $name_array[0]; // $last_name = end($name_array); // } else { // $first_name = $name; // $last_name = ''; // } $meta['first_name'] = $first_name; $meta['last_name'] = $last_name; // register user to WP $username = sanitize_user($email); $password = wp_generate_password(); is_multisite() ? wpmu_signup_user($username, $email, $meta) : wp_create_user($username, $password, $email); //wp_new_user_notification( $user_id, $password ); $response = $this->push_to_NB($email, $first_name, $last_name); return $response; }