本文整理汇总了PHP中signup_user函数的典型用法代码示例。如果您正苦于以下问题:PHP signup_user函数的具体用法?PHP signup_user怎么用?PHP signup_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了signup_user函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例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);
/** 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;
}
示例3: validate_blog_signup
/**
* Validate new site signup
*
* @since MU
*
* @uses wpmu_validate_user_signup() to retrieve an array of the new user data and errors
* @uses wpmu_validate_blog_signup() to retrieve an array of the new site data and errors
* @uses apply_filters() to make signup $meta filterable
* @uses signup_user() to signup a new user
* @uses signup_blog() to signup a the new user to a new site
* @return bool True if the site signup was validated, false if error
*/
function validate_blog_signup()
{
// Re-validate user info.
$result = wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
extract($result);
if ($errors->get_error_code()) {
signup_user($user_name, $user_email, $errors);
return false;
}
$result = wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title']);
extract($result);
if ($errors->get_error_code()) {
signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
return false;
}
$public = (int) $_POST['blog_public'];
$meta = array('lang_id' => 1, 'public' => $public);
//duplicate_hook
$meta = apply_filters('add_signup_meta', $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;
}
示例4: connect_db
$fname = $_POST["fname"];
$lname = $_POST["lname"];
$degree = $_POST["degree"];
$rollno = $_POST["rollno"];
$batch = $_POST["batch"];
$email = $_POST["email"];
$gender = $_POST["gender"];
$dob = $_POST["dob"];
$username = $_POST["username"];
$password = $_POST["password"];
if ($rollno != "" and $fname != "" and $lname != "" and $username != "" and $password != "" and $dob != "" and $gender != "" and $email != "" and $batch != "" and $degree != "") {
include "db.php";
$connectionStatu = connect_db();
$member = is_member($connectionStatu, $username);
if (!$member) {
$status = signup_user($connectionStatu, $fname, $lname, $rollno, $username, $degree, $batch, $gender, $dob, $email, $password);
/*echo print_r($status);exit;*/
if ($status == true) {
header("Location: signup.php?id=success&v=You are signed up successfully!!");
} else {
header("Location: signup.php?id=error&v=Error: An error has occured. Cannot sign up");
}
} else {
header("Location: signup.php?id=error&v=Error: Username:{$username} already exists");
}
} else {
header("Location: signup.php?id=error&v=Error: All fields mandatory");
}
} else {
header("Location: index.php?id=error&v=Please login to your account");
}
示例5: 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>';
//.........这里部分代码省略.........
示例6: 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;
}
示例7: validate_another_blog_signup
validate_another_blog_signup();
break;
case 'default':
default:
$user_email = isset($_POST['user_email']) ? $_POST['user_email'] : '';
/**
* Fires when the site sign-up form is sent.
*
* @since 3.0.0
*/
do_action('preprocess_signup_form');
if (is_user_logged_in() && ('all' === $active_signup || 'blog' === $active_signup)) {
signup_another_blog($newblogname);
} else {
if (false === is_user_logged_in() && ('all' === $active_signup || 'user' === $active_signup)) {
signup_user($newblogname, $user_email);
} else {
if (false === is_user_logged_in() && 'blog' === $active_signup) {
_e('Sorry, new registrations are not allowed at this time.');
} else {
_e('You are logged in already. No need to register again!');
}
}
}
if ($newblogname) {
$newblog = get_blogaddress_by_name($newblogname);
if ('blog' === $active_signup || 'all' === $active_signup) {
printf('<p><em>' . __('The site you were looking for, <strong>%s</strong>, does not exist, but you can create it now!') . '</em></p>', $newblog);
} else {
printf('<p><em>' . __('The site you were looking for, <strong>%s</strong>, does not exist.') . '</em></p>', $newblog);
}