本文整理汇总了PHP中wpmu_signup_user函数的典型用法代码示例。如果您正苦于以下问题:PHP wpmu_signup_user函数的具体用法?PHP wpmu_signup_user怎么用?PHP wpmu_signup_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpmu_signup_user函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: uf_validate_user_signup
/**
* 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;
}
}
开发者ID:WordImpress,项目名称:User-Frontend,代码行数:25,代码来源:action-register.php
示例2: validate_user_signup
/**
* 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;
}
开发者ID:aaronholbrook,项目名称:ms-custom-signup,代码行数:26,代码来源:new-user.php
示例3: custom_createuser
/**
* 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;
}
}
}
开发者ID:boonebgorges,项目名称:WP-Custom-New-User,代码行数:57,代码来源:custom-user-new.php
示例4: bp_core_signup_user
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;
}
开发者ID:newington,项目名称:buddypress,代码行数:49,代码来源:bp-members-signup.php
示例5: bp_core_signup_validate_user_signup
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;
}
开发者ID:alvaropereyra,项目名称:shrekcms,代码行数:16,代码来源:bp-core-signup.php
示例6: tml_display_register
/**
* 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>
//.........这里部分代码省略.........
开发者ID:tkxhoa,项目名称:movie,代码行数:101,代码来源:class-theme-my-login-ms-signup.php
示例7: signup_form_shortcode
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);
//.........这里部分代码省略.........
开发者ID:geminorum,项目名称:gmember,代码行数:101,代码来源:signup.class.php
示例8: gf_create_user
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: " . $user_data['user_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);
}
}
}
开发者ID:Inteleck,项目名称:hwc,代码行数:92,代码来源:userregistration.php
示例9: bp_core_signup_user
/**
* 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;
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:81,代码来源:bp-members-functions.php
示例10: validate_user_signup
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;
}
开发者ID:elizabethcb,项目名称:Daily-Globe,代码行数:18,代码来源:wp-signup.php
示例11: register
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);
}
开发者ID:newsapps,项目名称:wordpress-mtv,代码行数:9,代码来源:models.php
示例12: register
/**
* 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;
}
开发者ID:andreiRS,项目名称:Radii8,代码行数:53,代码来源:user.php
示例13: wp_idea_stream_users_update_signups_table
/**
* 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]));
}
开发者ID:mrjarbenne,项目名称:wp-idea-stream,代码行数:35,代码来源:functions.php
示例14: test_should_not_fail_for_existing_signup_with_same_email_if_signup_is_old
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', '[email protected]' );
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', '[email protected]' );
$this->assertNotContains( 'user_email', $v['errors']->get_error_codes() );
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:13,代码来源:wpmuValidateUserSignup.php
示例15: bp_core_signup_user
/**
* 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;
}
开发者ID:eresyyl,项目名称:mk,代码行数:56,代码来源:bp-members-functions.php
示例16: wp_user_parents_add_child
|
请发表评论