3 /** Sets up the WordPress Environment. */
4 require( dirname(__FILE__) . '/wp-load.php' );
6 add_action( 'wp_head', 'wp_no_robots' );
8 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
10 if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) ) {
11 wp_redirect( network_home_url() );
16 * Prints signup_header via wp_head
20 function do_signup_header() {
22 * Fires within the head section of the site sign-up screen.
26 do_action( 'signup_header' );
28 add_action( 'wp_head', 'do_signup_header' );
30 if ( !is_multisite() ) {
31 wp_redirect( wp_registration_url() );
35 if ( !is_main_site() ) {
36 wp_redirect( network_site_url( 'wp-signup.php' ) );
41 $wp_query->is_404 = false;
44 * Fires before the Site Signup page is loaded.
48 do_action( 'before_signup_header' );
51 * Prints styles for front-end Multisite signup pages
55 function wpmu_signup_stylesheet() {
57 <style type="text/css">
58 .mu_register { width: 90%; margin:0 auto; }
59 .mu_register form { margin-top: 2em; }
60 .mu_register .error { font-weight:700; padding:10px; color:#333333; background:#FFEBE8; border:1px solid #CC0000; }
61 .mu_register input[type="submit"],
62 .mu_register #blog_title,
63 .mu_register #user_email,
64 .mu_register #blogname,
65 .mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }
66 .mu_register #site-language { display: block; }
67 .mu_register .prefix_address,
68 .mu_register .suffix_address {font-size: 18px;display:inline; }
69 .mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; }
70 .mu_register label.checkbox { display:inline; }
71 .mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; }
76 add_action( 'wp_head', 'wpmu_signup_stylesheet' );
77 get_header( 'wp-signup' );
80 * Fires before the site sign-up form.
84 do_action( 'before_signup_form' );
86 <div id="signup-content" class="widecolumn">
87 <div class="mu_register wp-signup-container">
90 * Generates and displays the Signup and Create Site forms
94 * @param string $blogname The new site name
95 * @param string $blog_title The new site title
96 * @param array $errors
98 function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
99 $current_site = get_current_site();
101 if ( !is_subdomain_install() )
102 echo '<label for="blogname">' . __('Site Name:') . '</label>';
104 echo '<label for="blogname">' . __('Site Domain:') . '</label>';
106 if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
107 <p class="error"><?php echo $errmsg ?></p>
110 if ( !is_subdomain_install() )
111 echo '<span class="prefix_address">' . $current_site->domain . $current_site->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';
113 echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_site->domain ) ) . '</span><br />';
115 if ( !is_user_logged_in() ) {
116 if ( !is_subdomain_install() )
117 $site = $current_site->domain . $current_site->path . __( 'sitename' );
119 $site = __( 'domain' ) . '.' . $site_domain . $current_site->path;
120 echo '<p>(<strong>' . sprintf( __('Your address will be %s.'), $site ) . '</strong>) ' . __( 'Must be at least 4 characters, letters and numbers only. It cannot be changed, so choose carefully!' ) . '</p>';
125 <label for="blog_title"><?php _e('Site Title:') ?></label>
126 <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
127 <p class="error"><?php echo $errmsg ?></p>
129 echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />';
134 $languages = signup_get_available_languages();
136 if ( ! empty( $languages ) ) :
139 <label for="site-language"><?php _e( 'Site Language:' ); ?></label>
142 $lang = get_site_option( 'WPLANG' );
144 if ( isset( $_POST['WPLANG'] ) ) {
145 $lang = $_POST['WPLANG'];
148 // Use US English if the default isn't available.
149 if ( ! in_array( $lang, $languages ) ) {
153 wp_dropdown_languages( array(
155 'id' => 'site-language',
157 'languages' => $languages,
158 'show_available_translations' => false,
162 <?php endif; // Languages. ?>
165 <p class="privacy-intro">
166 <label for="blog_public_on"><?php _e('Privacy:') ?></label>
167 <?php _e( 'Allow search engines to index this site.' ); ?>
168 <br style="clear:both" />
169 <label class="checkbox" for="blog_public_on">
170 <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> />
171 <strong><?php _e( 'Yes' ); ?></strong>
173 <label class="checkbox" for="blog_public_off">
174 <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> />
175 <strong><?php _e( 'No' ); ?></strong>
182 * Fires after the site sign-up form.
186 * @param array $errors An array possibly containing 'blogname' or 'blog_title' errors.
188 do_action( 'signup_blogform', $errors );
192 * Validate the new site signup
196 * @return array Contains the new site data and error messages.
198 function validate_blog_form() {
200 if ( is_user_logged_in() )
201 $user = wp_get_current_user();
203 return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
207 * Display user registration form
211 * @param string $user_name The entered username
212 * @param string $user_email The entered email address
213 * @param array $errors
215 function show_user_form($user_name = '', $user_email = '', $errors = '') {
217 echo '<label for="user_name">' . __('Username:') . '</label>';
218 if ( $errmsg = $errors->get_error_message('user_name') ) {
219 echo '<p class="error">'.$errmsg.'</p>';
221 echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />';
222 _e( '(Must be at least 4 characters, letters and numbers only.)' );
225 <label for="user_email"><?php _e( 'Email Address:' ) ?></label>
226 <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
227 <p class="error"><?php echo $errmsg ?></p>
229 <input name="user_email" type="email" id="user_email" value="<?php echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?>
231 if ( $errmsg = $errors->get_error_message('generic') ) {
232 echo '<p class="error">' . $errmsg . '</p>';
235 * Fires at the end of the user registration form on the site sign-up form.
239 * @param array $errors An array possibly containing 'user_name' or 'user_email' errors.
241 do_action( 'signup_extra_fields', $errors );
245 * Validate user signup name and email
249 * @return array Contains username, email, and error messages.
251 function validate_user_form() {
252 return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
256 * Allow returning users to sign up for another site
260 * @param string $blogname The new site name
261 * @param string $blog_title The new site title.
262 * @param array $errors
264 function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
265 $current_user = wp_get_current_user();
267 if ( ! is_wp_error($errors) ) {
268 $errors = new WP_Error();
271 $signup_defaults = array(
272 'blogname' => $blogname,
273 'blog_title' => $blog_title,
278 * Filter the default site sign-up variables.
282 * @param array $signup_defaults {
283 * An array of default site sign-up variables.
285 * @type string $blogname The site blogname.
286 * @type string $blog_title The site title.
287 * @type array $errors An array possibly containing 'blogname' or 'blog_title' errors.
290 $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
292 $blogname = $filtered_results['blogname'];
293 $blog_title = $filtered_results['blog_title'];
294 $errors = $filtered_results['errors'];
296 echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>';
298 if ( $errors->get_error_code() ) {
299 echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
302 <p><?php printf( __( 'Welcome back, %s. By filling out the form below, you can <strong>add another site to your account</strong>. There is no limit to the number of sites you can have, so create to your heart’s content, but write responsibly!' ), $current_user->display_name ) ?></p>
305 $blogs = get_blogs_of_user($current_user->ID);
306 if ( !empty($blogs) ) { ?>
308 <p><?php _e( 'Sites you are already a member of:' ) ?></p>
310 <?php foreach ( $blogs as $blog ) {
311 $home_url = get_home_url( $blog->userblog_id );
312 echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
317 <p><?php _e( 'If you’re not going to use a great site domain, leave it for a new user. Now have at it!' ) ?></p>
318 <form id="setupform" method="post" action="wp-signup.php">
319 <input type="hidden" name="stage" value="gimmeanotherblog" />
322 * Hidden sign-up form fields output when creating another site or user.
326 * @param string $context A string describing the steps of the sign-up process. The value can be
327 * 'create-another-site', 'validate-user', or 'validate-site'.
329 do_action( 'signup_hidden_fields', 'create-another-site' );
331 <?php show_blog_form($blogname, $blog_title, $errors); ?>
332 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
338 * Validate a new site signup.
342 * @return null|bool True if site signup was validated, false if error.
343 * The function halts all execution if the user is not logged in.
345 function validate_another_blog_signup() {
346 global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
347 $current_user = wp_get_current_user();
348 if ( ! is_user_logged_in() ) {
352 $result = validate_blog_form();
354 // Extracted values set/overwrite globals.
355 $domain = $result['domain'];
356 $path = $result['path'];
357 $blogname = $result['blogname'];
358 $blog_title = $result['blog_title'];
359 $errors = $result['errors'];
361 if ( $errors->get_error_code() ) {
362 signup_another_blog($blogname, $blog_title, $errors);
366 $public = (int) $_POST['blog_public'];
368 $blog_meta_defaults = array(
373 // Handle the language setting for the new site.
374 if ( ! empty( $_POST['WPLANG'] ) ) {
376 $languages = signup_get_available_languages();
378 if ( in_array( $_POST['WPLANG'], $languages ) ) {
379 $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
382 $blog_meta_defaults['WPLANG'] = $language;
389 * Filter the new site meta variables.
392 * @deprecated 3.0.0 Use the 'add_signup_meta' filter instead.
394 * @param array $blog_meta_defaults An array of default blog meta variables.
396 $meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
399 * Filter the new default site meta variables.
403 * @param array $meta {
404 * An array of default site meta variables.
406 * @type int $lang_id The language ID.
407 * @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
410 $meta = apply_filters( 'add_signup_meta', $meta_defaults );
412 $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
414 if ( is_wp_error( $blog_id ) ) {
418 confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
423 * Confirm a new site signup.
426 * @since 4.4.0 Added the `$blog_id` parameter.
428 * @param string $domain The domain URL.
429 * @param string $path The site root path.
430 * @param string $blog_title The site title.
431 * @param string $user_name The username.
432 * @param string $user_email The user's email address.
433 * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup().
434 * @param int $blog_id The site ID.
436 function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) {
439 switch_to_blog( $blog_id );
440 $home_url = home_url( '/' );
441 $login_url = wp_login_url();
442 restore_current_blog();
444 $home_url = 'http://' . $domain . $path;
445 $login_url = 'http://' . $domain . $path . 'wp-login.php';
448 $site = sprintf( '<a href="%1$s">%2$s</a>',
449 esc_url( $home_url ),
454 <h2><?php printf( __( 'The site %s is yours.' ), $site ); ?></h2>
457 __( '<a href="%1$s">%2$s</a> is your new site. <a href="%3$s">Log in</a> as “%4$s” using your existing password.' ),
458 esc_url( $home_url ),
459 untrailingslashit( $domain . $path ),
460 esc_url( $login_url ),
466 * Fires when the site or user sign-up process is complete.
470 do_action( 'signup_finished' );
474 * Setup the new user signup process
478 * @param string $user_name The username
479 * @param string $user_email The user's email
480 * @param array $errors
482 function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
483 global $active_signup;
485 if ( !is_wp_error($errors) )
486 $errors = new WP_Error();
488 $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
490 $signup_user_defaults = array(
491 'user_name' => $user_name,
492 'user_email' => $user_email,
497 * Filter the default user variables used on the user sign-up form.
501 * @param array $signup_user_defaults {
502 * An array of default user variables.
504 * @type string $user_name The user username.
505 * @type string $user_email The user email address.
506 * @type array $errors An array of possible errors relevant to the sign-up user.
509 $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults );
510 $user_name = $filtered_results['user_name'];
511 $user_email = $filtered_results['user_email'];
512 $errors = $filtered_results['errors'];
516 <h2><?php printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name ) ?></h2>
517 <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate">
518 <input type="hidden" name="stage" value="validate-user-signup" />
520 /** This action is documented in wp-signup.php */
521 do_action( 'signup_hidden_fields', 'validate-user' );
523 <?php show_user_form($user_name, $user_email, $errors); ?>
526 <?php if ( $active_signup == 'blog' ) { ?>
527 <input id="signupblog" type="hidden" name="signup_for" value="blog" />
528 <?php } elseif ( $active_signup == 'user' ) { ?>
529 <input id="signupblog" type="hidden" name="signup_for" value="user" />
531 <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
532 <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
534 <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
535 <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
539 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p>
545 * Validate the new user signup
549 * @return bool True if new user signup was validated, false if error
551 function validate_user_signup() {
552 $result = validate_user_form();
553 $user_name = $result['user_name'];
554 $user_email = $result['user_email'];
555 $errors = $result['errors'];
557 if ( $errors->get_error_code() ) {
558 signup_user($user_name, $user_email, $errors);
562 if ( 'blog' == $_POST['signup_for'] ) {
563 signup_blog($user_name, $user_email);
567 /** This filter is documented in wp-signup.php */
568 wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
570 confirm_user_signup($user_name, $user_email);
575 * New user signup confirmation
579 * @param string $user_name The username
580 * @param string $user_email The user's email address
582 function confirm_user_signup($user_name, $user_email) {
584 <h2><?php /* translators: %s: username */
585 printf( __( '%s is your new username' ), $user_name) ?></h2>
586 <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
587 <p><?php /* translators: %s: email address */
588 printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p>
589 <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
591 /** This action is documented in wp-signup.php */
592 do_action( 'signup_finished' );
596 * Setup the new site signup
600 * @param string $user_name The username
601 * @param string $user_email The user's email address
602 * @param string $blogname The site name
603 * @param string $blog_title The site title
604 * @param array $errors
606 function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
607 if ( !is_wp_error($errors) )
608 $errors = new WP_Error();
610 $signup_blog_defaults = array(
611 'user_name' => $user_name,
612 'user_email' => $user_email,
613 'blogname' => $blogname,
614 'blog_title' => $blog_title,
619 * Filter the default site creation variables for the site sign-up form.
623 * @param array $signup_blog_defaults {
624 * An array of default site creation variables.
626 * @type string $user_name The user username.
627 * @type string $user_email The user email address.
628 * @type string $blogname The blogname.
629 * @type string $blog_title The title of the site.
630 * @type array $errors An array of possible errors relevant to new site creation variables.
633 $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults );
635 $user_name = $filtered_results['user_name'];
636 $user_email = $filtered_results['user_email'];
637 $blogname = $filtered_results['blogname'];
638 $blog_title = $filtered_results['blog_title'];
639 $errors = $filtered_results['errors'];
641 if ( empty($blogname) )
642 $blogname = $user_name;
644 <form id="setupform" method="post" action="wp-signup.php">
645 <input type="hidden" name="stage" value="validate-blog-signup" />
646 <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
647 <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
649 /** This action is documented in wp-signup.php */
650 do_action( 'signup_hidden_fields', 'validate-site' );
652 <?php show_blog_form($blogname, $blog_title, $errors); ?>
653 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
659 * Validate new site signup
663 * @return bool True if the site signup was validated, false if error
665 function validate_blog_signup() {
666 // Re-validate user info.
667 $user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
668 $user_name = $user_result['user_name'];
669 $user_email = $user_result['user_email'];
670 $user_errors = $user_result['errors'];
672 if ( $user_errors->get_error_code() ) {
673 signup_user( $user_name, $user_email, $user_errors );
677 $result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
678 $domain = $result['domain'];
679 $path = $result['path'];
680 $blogname = $result['blogname'];
681 $blog_title = $result['blog_title'];
682 $errors = $result['errors'];
684 if ( $errors->get_error_code() ) {
685 signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
689 $public = (int) $_POST['blog_public'];
690 $signup_meta = array ('lang_id' => 1, 'public' => $public);
692 // Handle the language setting for the new site.
693 if ( ! empty( $_POST['WPLANG'] ) ) {
695 $languages = signup_get_available_languages();
697 if ( in_array( $_POST['WPLANG'], $languages ) ) {
698 $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
701 $signup_meta['WPLANG'] = $language;
707 /** This filter is documented in wp-signup.php */
708 $meta = apply_filters( 'add_signup_meta', $signup_meta );
710 wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
711 confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
716 * New site signup confirmation
720 * @param string $domain The domain URL
721 * @param string $path The site root path
722 * @param string $blog_title The new site title
723 * @param string $user_name The user's username
724 * @param string $user_email The user's email address
725 * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
727 function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
729 <h2><?php /* translators: %s: site address */
730 printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
732 <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
733 <p><?php /* translators: %s: email address */
734 printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p>
735 <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
736 <h2><?php _e( 'Still waiting for your email?' ); ?></h2>
738 <?php _e( 'If you haven’t received your email yet, there are a number of things you can do:' ) ?>
739 <ul id="noemail-tips">
740 <li><p><strong><?php _e( 'Wait a little longer. Sometimes delivery of email can be delayed by processes outside of our control.' ) ?></strong></p></li>
741 <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
742 <li><?php printf( __( 'Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.' ), $user_email ) ?></li>
746 /** This action is documented in wp-signup.php */
747 do_action( 'signup_finished' );
751 * Retrieves languages available during the site/user signup process.
755 * @see get_available_languages()
757 * @return array List of available languages.
759 function signup_get_available_languages() {
761 * Filter the list of available languages for front-end site signups.
763 * Passing an empty array to this hook will disable output of the setting on the
764 * signup form, and the default language will be used when creating the site.
766 * Languages not already installed will be stripped.
770 * @param array $available_languages Available languages.
772 $languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() );
775 * Strip any non-installed languages and return.
777 * Re-call get_available_languages() here in case a language pack was installed
778 * in a callback hooked to the 'signup_get_available_languages' filter before this point.
780 return array_intersect_assoc( $languages, get_available_languages() );
784 $active_signup = get_site_option( 'registration', 'none' );
786 * Filter the type of site sign-up.
790 * @param string $active_signup String that returns registration type. The value can be
791 * 'all', 'none', 'blog', or 'user'.
793 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup );
795 // Make the signup type translatable.
796 $i18n_signup['all'] = _x('all', 'Multisite active signup type');
797 $i18n_signup['none'] = _x('none', 'Multisite active signup type');
798 $i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
799 $i18n_signup['user'] = _x('user', 'Multisite active signup type');
801 if ( is_super_admin() )
802 echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing “%s” registrations. To change or disable registration go to your <a href="%s">Options page</a>.' ), $i18n_signup[$active_signup], esc_url( network_admin_url( 'settings.php' ) ) ) . '</div>';
804 $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
806 $current_user = wp_get_current_user();
807 if ( $active_signup == 'none' ) {
808 _e( 'Registration has been disabled.' );
809 } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
810 $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
811 echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
813 $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
815 case 'validate-user-signup' :
816 if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' )
817 validate_user_signup();
819 _e( 'User registration has been disabled.' );
821 case 'validate-blog-signup':
822 if ( $active_signup == 'all' || $active_signup == 'blog' )
823 validate_blog_signup();
825 _e( 'Site registration has been disabled.' );
827 case 'gimmeanotherblog':
828 validate_another_blog_signup();
832 $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
834 * Fires when the site sign-up form is sent.
838 do_action( 'preprocess_signup_form' );
839 if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
840 signup_another_blog($newblogname);
841 elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) )
842 signup_user( $newblogname, $user_email );
843 elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) )
844 _e( 'Sorry, new registrations are not allowed at this time.' );
846 _e( 'You are logged in already. No need to register again!' );
848 if ( $newblogname ) {
849 $newblog = get_blogaddress_by_name( $newblogname );
851 if ( $active_signup == 'blog' || $active_signup == 'all' )
852 /* translators: %s: site address */
853 printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',
854 '<strong>' . $newblog . '</strong>'
857 /* translators: %s: site address */
858 printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>',
859 '<strong>' . $newblog . '</strong>'
870 * Fires after the sign-up forms, before wp_footer.
874 do_action( 'after_signup_form' ); ?>
876 <?php get_footer( 'wp-signup' );