本文整理汇总了PHP中wpmu_validate_user_signup函数的典型用法代码示例。如果您正苦于以下问题:PHP wpmu_validate_user_signup函数的具体用法?PHP wpmu_validate_user_signup怎么用?PHP wpmu_validate_user_signup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wpmu_validate_user_signup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: msxmlrpc_create_blog
/**
* Creates a new blog calling wpmu_create_blog
* the wpmu_create_blog parameters are:
* $domain The domain of the new blog.
* $path The path of the new blog.
* $title The title of the new blog.
* $user_id The user id of the user account who will be the blog admin. (you can use an email instead of the user_id. If so, a new user will be created)
* $meta Other meta information.
* $site_id The site_id of the blog to be created.
*
* @param array $args Array with username, password and wpmu_create_blog function parameters
* @return mixed The new blog id or an error message
*/
function msxmlrpc_create_blog($args)
{
$parameters = check_arguments($args);
if (!is_array($parameters)) {
return $parameters;
}
// if the user_id is the user's e-mail
if (!is_int($parameters['user_id'])) {
if (!($user_id = get_user_id_from_string($parameters['user_id']))) {
$error = wpmu_validate_user_signup($parameters['path'], $parameters['user_id']);
if (is_wp_error($error)) {
return new IXR_Error(500, $error->get_error_message());
}
$user_id = wpmu_create_user($parameters['path'], wp_generate_password(), $parameters['user_id']);
}
$parameters['user_id'] = $user_id;
}
if (get_blog_id($parameters['domain'], $parameters['path']) !== false) {
return new IXR_Error(500, __("Site already exists."));
}
if (!isset($parameters['meta'])) {
$parameters['meta'] = "";
}
if (!isset($parameters['site_id'])) {
$parameters['site_id'] = 1;
}
return wpmu_create_blog($parameters['domain'], $parameters['path'], $parameters['title'], $parameters['user_id'], $parameters['meta'], $parameters['site_id']);
}
开发者ID:renanivo,项目名称:WP-Multisite-XML-RPC,代码行数:41,代码来源:multisite-xml-rpc.php
示例2: validate_blog_signup
/**
* Validate new site signup
*
* @since MU
*
* @return bool True if the site signup was validated, false if error
*/
function validate_blog_signup()
{
// Re-validate user info.
$user_result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
$user_name = $user_result['user_name'];
$user_email = $user_result['user_email'];
$user_errors = $user_result['errors'];
if ($user_errors->get_error_code()) {
signup_user($user_name, $user_email, $user_errors);
return false;
}
$result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
$domain = $result['domain'];
$path = $result['path'];
$blogname = $result['blogname'];
$blog_title = $result['blog_title'];
$errors = $result['errors'];
if ($errors->get_error_code()) {
signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
return false;
}
$public = (int) $_POST['blog_public'];
$signup_meta = array('lang_id' => 1, 'public' => $public);
// Handle the language setting for the new site.
if (!empty($_POST['WPLANG'])) {
$languages = signup_get_available_languages();
if (in_array($_POST['WPLANG'], $languages)) {
$language = wp_unslash(sanitize_text_field($_POST['WPLANG']));
if ($language) {
$signup_meta['WPLANG'] = $language;
}
}
}
/** This filter is documented in wp-signup.php */
$meta = apply_filters('add_signup_meta', $signup_meta);
wpmu_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;
}
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:46,代码来源:wp-signup.php
示例3: edit_user
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 {
// 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 {
/**
* 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
}
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:31,代码来源:user-new.php
示例4: test_illegal_user_logins_multisite
/**
* @ticket 27317
*/
function test_illegal_user_logins_multisite()
{
if (!is_multisite()) {
return;
}
$user_data = array('user_login' => 'testuser', 'user_email' => '[email protected]');
add_filter('illegal_user_logins', array($this, '_illegal_user_logins'));
$response = wpmu_validate_user_signup($user_data['user_login'], $user_data['user_email']);
$this->assertInstanceOf('WP_Error', $response['errors']);
$this->assertEquals('user_name', $response['errors']->get_error_code());
remove_filter('illegal_user_logins', array($this, '_illegal_user_logins'));
$response = wpmu_validate_user_signup($user_data['user_login'], $user_data['user_email']);
$this->assertInstanceOf('WP_Error', $response['errors']);
$this->assertEquals(0, count($response['errors']->get_error_codes()));
}
开发者ID:rclilly,项目名称:wordpress-develop,代码行数:18,代码来源:user.php
示例5: validate_blog_signup
/**
* Validate new site signup
*
* @since MU
*
* @return bool True if the site signup was validated, false if error
*/
function validate_blog_signup() {
// Re-validate user info.
$user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
$user_name = $user_result['user_name'];
$user_email = $user_result['user_email'];
$user_errors = $user_result['errors'];
if ( $user_errors->get_error_code() ) {
signup_user( $user_name, $user_email, $user_errors );
return false;
}
$result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
$domain = $result['domain'];
$path = $result['path'];
$blogname = $result['blogname'];
$blog_title = $result['blog_title'];
$errors = $result['errors'];
if ( $errors->get_error_code() ) {
signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
return false;
}
$public = (int) $_POST['blog_public'];
$signup_meta = array ('lang_id' => 1, 'public' => $public);
/** This filter is documented in wp-signup.php */
$meta = apply_filters( 'add_signup_meta', $signup_meta );
wpmu_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;
}
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:41,代码来源:wp-signup.php
示例6: user_registration_validation
public static function user_registration_validation($validation_result)
{
$form = $validation_result['form'];
$entry = self::convert_post_to_entry();
$config = self::get_active_config($form, $entry);
$is_update_feed = rgars($config, 'meta/feed_type') == 'update';
$pagenum = rgpost("gform_source_page_number_{$form['id']}");
// if there is no registration feed or the registration condition is not met or feed is inactive, abandon ship
if (!$config || !self::registration_condition_met($form, $config, $entry) || !$config['is_active']) {
return $validation_result;
}
$username_field = RGFormsModel::get_field($form, $config['meta']['username']);
$email_field = RGFormsModel::get_field($form, $config['meta']['email']);
$password_field = RGFormsModel::get_field($form, $config['meta']['password']);
$is_username_hidden = RGFormsModel::is_field_hidden($form, $username_field, array());
$is_email_hidden = RGFormsModel::is_field_hidden($form, $email_field, array());
$is_password_hidden = RGFormsModel::is_field_hidden($form, $password_field, array());
$user_name = apply_filters("gform_username_{$form['id']}", apply_filters('gform_username', self::get_meta_value('username', $config, $form, $entry), $config, $form, $entry), $config, $form, $entry);
$user_email = self::get_prepared_value($email_field, $config['meta']['email'], $entry);
$user_pass = rgpost('input_' . $config['meta']['password']);
//$user_pass = stripslashes( $user_pass );
if (!function_exists('username_exists')) {
require_once ABSPATH . WPINC . "/registration.php";
}
// if password field is not hidden and is on the current page we are validating, validate it
if (!$is_password_hidden && $password_field['pageNumber'] == $pagenum) {
if (strpos($user_pass, "\\") !== false) {
$form = self::add_validation_failure($config['meta']['password'], $form, __('Passwords may not contain the character "\\"', 'gravityformsuserregistration'));
}
}
if (is_multisite()) {
// if multisite is defined and true, lowercase name for validation
$user_name = strtolower($user_name);
$_POST['input_' . str_replace('.', '_', $config['meta']['username'])] = $user_name;
$result = wpmu_validate_user_signup($user_name, $user_email);
$errors = $result['errors']->errors;
// special validation overrides for update feeds
if ($is_update_feed) {
// do not validate username on update feeds
if (isset($errors['user_name'])) {
unset($errors['user_name']);
}
// do not validate if email belongs to user
if (isset($errors['user_email'])) {
for ($i = count($errors['user_email']) - 1; $i >= 0; $i--) {
$error_message = $errors['user_email'][$i];
// if user is re-submitting their own email address, don't give already used error
if ($error_message == __('Sorry, that email address is already used!') && self::is_users_email($user_email)) {
unset($errors['user_email'][$i]);
} elseif ($error_message == __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.') && self::is_users_email($user_email)) {
unset($errors['user_email'][$i]);
}
}
// if no other user email errors remain, unset
if (count($errors['user_email']) <= 0) {
unset($errors['user_email']);
}
}
}
if (!empty($errors)) {
foreach ($errors as $type => $error_msgs) {
foreach ($error_msgs as $error_msg) {
switch ($type) {
case 'user_name':
if (!$is_username_hidden && $username_field['pageNumber'] == $pagenum) {
$form = self::add_validation_failure($config['meta']['username'], $form, $error_msg);
}
break;
case 'user_email':
if (!$is_email_hidden && $email_field['pageNumber'] == $pagenum) {
$form = self::add_validation_failure($config['meta']['email'], $form, $error_msg);
}
break;
}
}
}
}
} else {
if (!$is_email_hidden && $email_field['pageNumber'] == $pagenum) {
$email_valid = true;
$email_exists = email_exists($user_email);
if (!$user_email) {
$email_valid = false;
$form = self::add_validation_failure($config['meta']['email'], $form, __('The email address can not be empty', 'gravityformsuserregistration'));
}
if ($email_valid && self::pending_activation_exists('user_email', $user_email)) {
$email_valid = false;
$form = self::add_validation_failure($config['meta']['email'], $form, __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
}
if ($email_valid && !$is_update_feed && $email_exists) {
$form = self::add_validation_failure($config['meta']['email'], $form, __('This email address is already registered', 'gravityformsuserregistration'));
} elseif ($email_valid && $is_update_feed && $email_exists && !self::is_users_email($user_email)) {
$form = self::add_validation_failure($config['meta']['email'], $form, __('This email address is already registered', 'gravityformsuserregistration'));
}
}
// do not validate the user name if this is an update feed, if the user name field is hidden or if we are not on the correct page
if (!$is_update_feed && !$is_username_hidden && $username_field['pageNumber'] == $pagenum) {
$username_valid = true;
if (empty($user_name)) {
$username_valid = false;
//.........这里部分代码省略.........
开发者ID:Inteleck,项目名称:hwc,代码行数:101,代码来源:userregistration.php
示例7: wp_die
}
if (!current_user_can('create_users')) {
wp_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.wordpress.org/Network_Admin_Users_Screen" target="_blank">Documentation on Network Users</a>') . '</p>' . '<p>' . __('<a href="http://wordpress.org/support/forum/multisite/" target="_blank">Support Forums</a>') . '</p>');
if (isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action']) {
check_admin_referer('add-user', '_wpnonce_add-user');
if (!current_user_can('manage_network_users')) {
wp_die(__('You do not have permission to access this page.'));
}
if (!is_array($_POST['user'])) {
wp_die(__('Cannot create an empty user.'));
}
$user = $_POST['user'];
$user_details = wpmu_validate_user_signup($user['username'], $user['email']);
if (is_wp_error($user_details['errors']) && !empty($user_details['errors']->errors)) {
$add_user_errors = $user_details['errors'];
} else {
$password = wp_generate_password(12, false);
$user_id = wpmu_create_user(esc_html(strtolower($user['username'])), $password, esc_html($user['email']));
if (!$user_id) {
$add_user_errors = new WP_Error('add_user_fail', __('Cannot add user.'));
} else {
wp_new_user_notification($user_id, $password);
wp_redirect(add_query_arg(array('update' => 'added'), 'user-new.php'));
exit;
}
}
}
if (isset($_GET['update'])) {
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:31,代码来源:user-new.php
示例8: bp_core_validate_user_signup
/**
* Validate a user name and email address when creating a new user.
*
* @since 1.2.2
*
* @param string $user_name Username to validate.
* @param string $user_email Email address to validate.
* @return array Results of user validation including errors, if any.
*/
function bp_core_validate_user_signup($user_name, $user_email)
{
// Make sure illegal names include BuddyPress slugs and values.
bp_core_flush_illegal_names();
// WordPress Multisite has its own validation. Use it, so that we
// properly mirror restrictions on username, etc.
if (function_exists('wpmu_validate_user_signup')) {
$result = wpmu_validate_user_signup($user_name, $user_email);
// When not running Multisite, we perform our own validation. What
// follows reproduces much of the logic of wpmu_validate_user_signup(),
// minus the multisite-specific restrictions on user_login.
} else {
$errors = new WP_Error();
/**
* Filters the username before being validated.
*
* @since 1.5.5
*
* @param string $user_name Username to validate.
*/
$user_name = apply_filters('pre_user_login', $user_name);
// User name can't be empty.
if (empty($user_name)) {
$errors->add('user_name', __('Please enter a username', 'buddypress'));
}
// User name can't be on the blacklist.
$illegal_names = get_site_option('illegal_names');
if (in_array($user_name, (array) $illegal_names)) {
$errors->add('user_name', __('That username is not allowed', 'buddypress'));
}
// User name must pass WP's validity check.
if (!validate_username($user_name)) {
$errors->add('user_name', __('Usernames can contain only letters, numbers, ., -, and @', 'buddypress'));
}
// Minimum of 4 characters.
if (strlen($user_name) < 4) {
$errors->add('user_name', __('Username must be at least 4 characters', 'buddypress'));
}
// No underscores. @todo Why not?
if (false !== strpos(' ' . $user_name, '_')) {
$errors->add('user_name', __('Sorry, usernames may not contain the character "_"!', 'buddypress'));
}
// No usernames that are all numeric. @todo Why?
$match = array();
preg_match('/[0-9]*/', $user_name, $match);
if ($match[0] == $user_name) {
$errors->add('user_name', __('Sorry, usernames must have letters too!', 'buddypress'));
}
// Check into signups.
$signups = BP_Signup::get(array('user_login' => $user_name));
$signup = isset($signups['signups']) && !empty($signups['signups'][0]) ? $signups['signups'][0] : false;
// Check if the username has been used already.
if (username_exists($user_name) || !empty($signup)) {
$errors->add('user_name', __('Sorry, that username already exists!', 'buddypress'));
}
// Validate the email address and process the validation results into
// error messages.
$validate_email = bp_core_validate_email_address($user_email);
bp_core_add_validation_error_messages($errors, $validate_email);
// Assemble the return array.
$result = array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors);
// Apply WPMU legacy filter.
$result = apply_filters('wpmu_validate_user_signup', $result);
}
/**
* Filters the result of the user signup validation.
*
* @since 1.2.2
*
* @param array $result Results of user validation including errors, if any.
*/
return apply_filters('bp_core_validate_user_signup', $result);
}
开发者ID:CompositeUK,项目名称:clone.BuddyPress,代码行数:82,代码来源:bp-members-functions.php
示例9: stripe_form_submission_validation_errors
/**
* Validates different kinds of form submissions.
*
* Free Registration Forms do NOT require API Credentials.
*
* @package s2Member\Stripe
* @since 140617
*
* @param string $form The type of Pro-Form being submitted.
* @param array $s An array of data submitted through the Pro-Form.
*
* @return null|array Null if there are no errors, else a response array.
*/
public static function stripe_form_submission_validation_errors($form, $s = array())
{
$cp_attr = c_ws_plugin__s2member_pro_stripe_utilities::apply_coupon($s['attr'], $s['coupon'], 'attr');
$is_free_checkout = in_array($form, array('sp-checkout', 'checkout'), TRUE) && $cp_attr['ta'] <= 0 && $cp_attr['ra'] <= 0;
$is_bitcoin_checkout = !$is_free_checkout && in_array($form, array('sp-checkout', 'checkout'), TRUE) && stripos($s['source_token'], 'btcrcv_') === 0;
if ($form === 'registration' || !($response = c_ws_plugin__s2member_pro_stripe_responses::stripe_form_api_validation_errors())) {
if ($form === 'cancellation') {
if (!is_user_logged_in()) {
$response = array('response' => sprintf(_x('You must <a href="%s" rel="nofollow">log in</a> to cancel your account.', 's2member-front', 's2member'), esc_attr(wp_login_url($_SERVER['REQUEST_URI']))), 'error' => TRUE);
} else {
if ($s['attr']['captcha'] && (empty($s['recaptcha_challenge_field']) || empty($s['recaptcha_response_field']) || !c_ws_plugin__s2member_utils_captchas::recaptcha_code_validates($s['recaptcha_challenge_field'], $s['recaptcha_response_field']))) {
$response = array('response' => _x('Missing or invalid Security Verification. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if (is_object($user = wp_get_current_user()) && $user->ID && $user->has_cap('administrator')) {
$response = array('response' => _x('Unable to process. You are an Administrator. Stopping here for security. Otherwise, an Administrator could lose access.', 's2member-admin', 's2member'), 'error' => TRUE);
}
}
}
} else {
if ($form === 'update') {
if (!is_user_logged_in()) {
$response = array('response' => sprintf(_x('You must <a href="%s" rel="nofollow">log in</a> to update your billing information.', 's2member-front', 's2member'), esc_attr(wp_login_url($_SERVER['REQUEST_URI']))), 'error' => TRUE);
} else {
if (is_object($user = wp_get_current_user()) && $user->ID && $user->has_cap('administrator')) {
$response = array('response' => _x('Unable to process. You are an Administrator. Stopping here for security. Otherwise, an Administrator could lose access.', 's2member-admin', 's2member'), 'error' => TRUE);
} else {
if (empty($s['source_token']) || !is_string($s['source_token'])) {
$response = array('response' => _x('Missing Billing Info. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if ($s['attr']['captcha'] && (empty($s['recaptcha_challenge_field']) || empty($s['recaptcha_response_field']) || !c_ws_plugin__s2member_utils_captchas::recaptcha_code_validates($s['recaptcha_challenge_field'], $s['recaptcha_response_field']))) {
$response = array('response' => _x('Missing or invalid Security Verification. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
}
}
}
}
} else {
if ($form === 'registration') {
/** @var $_errors \WP_Error For IDEs. This variable is used below in at least one place. */
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_names'] && (empty($s['first_name']) || !is_string($s['first_name']))) {
$response = array('response' => _x('Missing First Name. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if ($GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_names'] && (empty($s['last_name']) || !is_string($s['last_name']))) {
$response = array('response' => _x('Missing Last Name. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if (empty($s['email']) || !is_string($s['email'])) {
$response = array('response' => _x('Missing or invalid Email Address. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if (!is_email($s['email'])) {
$response = array('response' => _x('Invalid Email Address. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if (email_exists($s['email']) && (!is_multisite() || !c_ws_plugin__s2member_utils_users::ms_user_login_email_can_join_blog(@$s['username'], $s['email']))) {
$response = array('response' => _x('That Email Address is already in use. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if (empty($s['username']) || !is_string($s['username']) || empty($s['_o_username']) || !is_string($s['_o_username'])) {
$response = array('response' => _x('Missing or invalid Username. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if (!validate_username($s['username']) || !validate_username($s['_o_username'])) {
$response = array('response' => _x('Invalid Username. Please try again. Use ONLY lowercase alphanumerics.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if (username_exists($s['username']) && (!is_multisite() || !c_ws_plugin__s2member_utils_users::ms_user_login_email_can_join_blog($s['username'], $s['email']))) {
$response = array('response' => _x('That Username is already in use. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if (is_multisite() && !c_ws_plugin__s2member_utils_users::ms_user_login_email_can_join_blog($s['username'], $s['email']) && ($_response = wpmu_validate_user_signup($s['username'], $s['email'])) && is_wp_error($_errors = $_response['errors']) && $_errors->get_error_message()) {
$response = array('response' => $_errors->get_error_message(), 'error' => TRUE);
} else {
if ((empty($s['password1']) || !is_string($s['password1'])) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password']) {
$response = array('response' => _x('Missing Password. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if ((empty($s['password1']) || strlen($s['password1']) < c_ws_plugin__s2member_user_securities::min_password_length()) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password']) {
$response = array('response' => sprintf(_x('Invalid Password. Must be at least %1$s characters. Please try again.', 's2member-front', 's2member'), c_ws_plugin__s2member_user_securities::min_password_length()), 'error' => TRUE);
} else {
if (!empty($s['password1']) && strlen($s['password1']) > 64 && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password']) {
$response = array('response' => _x('Invalid Password. Max length is 64 characters. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if ((empty($s['password2']) || $s['password2'] !== $s['password1']) && $GLOBALS['WS_PLUGIN__']['s2member']['o']['custom_reg_password']) {
$response = array('response' => _x('Password fields do NOT match. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
} else {
if ($custom_field_validation_errors = c_ws_plugin__s2member_custom_reg_fields::validation_errors(isset($s['custom_fields']) ? $s['custom_fields'] : array(), c_ws_plugin__s2member_custom_reg_fields::custom_fields_configured_at_level($s['attr']['level'], 'registration', TRUE))) {
$response = array('response' => array_shift($custom_field_validation_errors), 'error' => TRUE);
} else {
if ($s['attr']['captcha'] && (empty($s['recaptcha_challenge_field']) || empty($s['recaptcha_response_field']) || !c_ws_plugin__s2member_utils_captchas::recaptcha_code_validates($s['recaptcha_challenge_field'], $s['recaptcha_response_field']))) {
$response = array('response' => _x('Missing or invalid Security Verification. Please try again.', 's2member-front', 's2member'), 'error' => TRUE);
}
}
}
}
}
//.........这里部分代码省略.........
开发者ID:SollyNZ,项目名称:damn-plugins,代码行数:101,代码来源:stripe-responses.inc.php
示例10: 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
示例11: create_item
/**
* Create a single user
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|WP_REST_Response
*/
public function create_item($request)
{
global $wp_roles;
if (!empty($request['id'])) {
return new WP_Error('rest_user_exists', __('Cannot create existing user.'), array('status' => 400));
}
$user = $this->prepare_item_for_database($request);
if (is_multisite()) {
$ret = wpmu_validate_user_signup($user->user_login, $user->user_email);
if (is_wp_error($ret['errors']) && !empty($ret['errors']->errors)) {
return $ret['errors'];
}
}
if (is_multisite()) {
$user_id = wpmu_create_user($user->user_login, $user->user_pass, $user->user_email);
if (!$user_id) {
return new WP_Error('rest_user_create', __('Error creating new user.'), array('status' => 500));
}
$user->ID = $user_id;
$user_id = wp_update_user($user);
if (is_wp_error($user_id)) {
return $user_id;
}
} else {
$user_id = wp_insert_user($user);
if (is_wp_error($user_id)) {
return $user_id;
}
$user->ID = $user_id;
}
$this->update_additional_fields_for_object($user, $request);
/**
* Fires after a user is created or updated via the REST API.
*
* @param object $user Data used to create the user (not a WP_User object).
* @param WP_REST_Request $request Request object.
* @param bool $creating True when creating user, false when updating user.
*/
do_action('rest_insert_user', $user, $request, true);
$response = $this->get_item(array('id' => $user_id, 'context' => 'edit'));
$response = rest_ensure_response($response);
$response->set_status(201);
$response->header('Location', rest_url('/wp/v2/users/' . $user_id));
return $response;
}
开发者ID:pristupaeugen,项目名称:wordpress_rest_api,代码行数:51,代码来源:class-wp-rest-users-controller.php
示例12: rpr_preprocess_signup_form
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>';
//.........这里部分代码省略.........
开发者ID:bvassmer,项目名称:Register-Plus-Redux,代码行数:101,代码来源:rpr-signup.php
|
请发表评论