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 WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
98 function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
99 if ( ! is_wp_error( $errors ) ) {
100 $errors = new WP_Error();
103 $current_network = get_network();
105 if ( !is_subdomain_install() )
106 echo '<label for="blogname">' . __('Site Name:') . '</label>';
108 echo '<label for="blogname">' . __('Site Domain:') . '</label>';
110 if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
111 <p class="error"><?php echo $errmsg ?></p>
114 if ( !is_subdomain_install() )
115 echo '<span class="prefix_address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="'. esc_attr($blogname) .'" maxlength="60" /><br />';
117 echo '<input name="blogname" type="text" id="blogname" value="'.esc_attr($blogname).'" maxlength="60" /><span class="suffix_address">.' . ( $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ) ) . '</span><br />';
119 if ( ! is_user_logged_in() ) {
120 if ( ! is_subdomain_install() ) {
121 $site = $current_network->domain . $current_network->path . __( 'sitename' );
123 $site = __( 'domain' ) . '.' . $site_domain . $current_network->path;
126 /* translators: %s: site address */
127 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>';
132 <label for="blog_title"><?php _e('Site Title:') ?></label>
133 <?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
134 <p class="error"><?php echo $errmsg ?></p>
136 echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />';
141 $languages = signup_get_available_languages();
143 if ( ! empty( $languages ) ) :
146 <label for="site-language"><?php _e( 'Site Language:' ); ?></label>
149 $lang = get_site_option( 'WPLANG' );
151 if ( isset( $_POST['WPLANG'] ) ) {
152 $lang = $_POST['WPLANG'];
155 // Use US English if the default isn't available.
156 if ( ! in_array( $lang, $languages ) ) {
160 wp_dropdown_languages( array(
162 'id' => 'site-language',
164 'languages' => $languages,
165 'show_available_translations' => false,
169 <?php endif; // Languages. ?>
172 <p class="privacy-intro">
173 <label for="blog_public_on"><?php _e('Privacy:') ?></label>
174 <?php _e( 'Allow search engines to index this site.' ); ?>
175 <br style="clear:both" />
176 <label class="checkbox" for="blog_public_on">
177 <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 } ?> />
178 <strong><?php _e( 'Yes' ); ?></strong>
180 <label class="checkbox" for="blog_public_off">
181 <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 } ?> />
182 <strong><?php _e( 'No' ); ?></strong>
189 * Fires after the site sign-up form.
193 * @param WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
195 do_action( 'signup_blogform', $errors );
199 * Validate the new site signup
203 * @return array Contains the new site data and error messages.
205 function validate_blog_form() {
207 if ( is_user_logged_in() )
208 $user = wp_get_current_user();
210 return wpmu_validate_blog_signup($_POST['blogname'], $_POST['blog_title'], $user);
214 * Display user registration form
218 * @param string $user_name The entered username.
219 * @param string $user_email The entered email address.
220 * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
222 function show_user_form($user_name = '', $user_email = '', $errors = '') {
223 if ( ! is_wp_error( $errors ) ) {
224 $errors = new WP_Error();
228 echo '<label for="user_name">' . __('Username:') . '</label>';
229 if ( $errmsg = $errors->get_error_message('user_name') ) {
230 echo '<p class="error">'.$errmsg.'</p>';
232 echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr( $user_name ) .'" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
233 _e( '(Must be at least 4 characters, letters and numbers only.)' );
236 <label for="user_email"><?php _e( 'Email Address:' ) ?></label>
237 <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
238 <p class="error"><?php echo $errmsg ?></p>
240 <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.)') ?>
242 if ( $errmsg = $errors->get_error_message('generic') ) {
243 echo '<p class="error">' . $errmsg . '</p>';
246 * Fires at the end of the user registration form on the site sign-up form.
250 * @param WP_Error $errors A WP_Error object containing containing 'user_name' or 'user_email' errors.
252 do_action( 'signup_extra_fields', $errors );
256 * Validate user signup name and email
260 * @return array Contains username, email, and error messages.
262 function validate_user_form() {
263 return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
267 * Allow returning users to sign up for another site
271 * @param string $blogname The new site name
272 * @param string $blog_title The new site title.
273 * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
275 function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
276 $current_user = wp_get_current_user();
278 if ( ! is_wp_error($errors) ) {
279 $errors = new WP_Error();
282 $signup_defaults = array(
283 'blogname' => $blogname,
284 'blog_title' => $blog_title,
289 * Filters the default site sign-up variables.
293 * @param array $signup_defaults {
294 * An array of default site sign-up variables.
296 * @type string $blogname The site blogname.
297 * @type string $blog_title The site title.
298 * @type WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
301 $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
303 $blogname = $filtered_results['blogname'];
304 $blog_title = $filtered_results['blog_title'];
305 $errors = $filtered_results['errors'];
307 echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
309 if ( $errors->get_error_code() ) {
310 echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
313 <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>
316 $blogs = get_blogs_of_user($current_user->ID);
317 if ( !empty($blogs) ) { ?>
319 <p><?php _e( 'Sites you are already a member of:' ) ?></p>
321 <?php foreach ( $blogs as $blog ) {
322 $home_url = get_home_url( $blog->userblog_id );
323 echo '<li><a href="' . esc_url( $home_url ) . '">' . $home_url . '</a></li>';
328 <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>
329 <form id="setupform" method="post" action="wp-signup.php">
330 <input type="hidden" name="stage" value="gimmeanotherblog" />
333 * Hidden sign-up form fields output when creating another site or user.
337 * @param string $context A string describing the steps of the sign-up process. The value can be
338 * 'create-another-site', 'validate-user', or 'validate-site'.
340 do_action( 'signup_hidden_fields', 'create-another-site' );
342 <?php show_blog_form($blogname, $blog_title, $errors); ?>
343 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Create Site' ) ?>" /></p>
349 * Validate a new site signup.
353 * @return null|bool True if site signup was validated, false if error.
354 * The function halts all execution if the user is not logged in.
356 function validate_another_blog_signup() {
357 global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
358 $current_user = wp_get_current_user();
359 if ( ! is_user_logged_in() ) {
363 $result = validate_blog_form();
365 // Extracted values set/overwrite globals.
366 $domain = $result['domain'];
367 $path = $result['path'];
368 $blogname = $result['blogname'];
369 $blog_title = $result['blog_title'];
370 $errors = $result['errors'];
372 if ( $errors->get_error_code() ) {
373 signup_another_blog($blogname, $blog_title, $errors);
377 $public = (int) $_POST['blog_public'];
379 $blog_meta_defaults = array(
384 // Handle the language setting for the new site.
385 if ( ! empty( $_POST['WPLANG'] ) ) {
387 $languages = signup_get_available_languages();
389 if ( in_array( $_POST['WPLANG'], $languages ) ) {
390 $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
393 $blog_meta_defaults['WPLANG'] = $language;
400 * Filters the new site meta variables.
402 * Use the {@see 'add_signup_meta'} filter instead.
405 * @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead.
407 * @param array $blog_meta_defaults An array of default blog meta variables.
409 $meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
412 * Filters the new default site meta variables.
416 * @param array $meta {
417 * An array of default site meta variables.
419 * @type int $lang_id The language ID.
420 * @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
423 $meta = apply_filters( 'add_signup_meta', $meta_defaults );
425 $blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
427 if ( is_wp_error( $blog_id ) ) {
431 confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
436 * Confirm a new site signup.
439 * @since 4.4.0 Added the `$blog_id` parameter.
441 * @param string $domain The domain URL.
442 * @param string $path The site root path.
443 * @param string $blog_title The site title.
444 * @param string $user_name The username.
445 * @param string $user_email The user's email address.
446 * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup().
447 * @param int $blog_id The site ID.
449 function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) {
452 switch_to_blog( $blog_id );
453 $home_url = home_url( '/' );
454 $login_url = wp_login_url();
455 restore_current_blog();
457 $home_url = 'http://' . $domain . $path;
458 $login_url = 'http://' . $domain . $path . 'wp-login.php';
461 $site = sprintf( '<a href="%1$s">%2$s</a>',
462 esc_url( $home_url ),
468 /* translators: %s: site name */
469 printf( __( 'The site %s is yours.' ), $site );
473 /* translators: 1: home URL, 2: site address, 3: login URL, 4: username */
474 __( '<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.' ),
475 esc_url( $home_url ),
476 untrailingslashit( $domain . $path ),
477 esc_url( $login_url ),
483 * Fires when the site or user sign-up process is complete.
487 do_action( 'signup_finished' );
491 * Setup the new user signup process
495 * @param string $user_name The username.
496 * @param string $user_email The user's email.
497 * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
499 function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
500 global $active_signup;
502 if ( !is_wp_error($errors) )
503 $errors = new WP_Error();
505 $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
507 $signup_user_defaults = array(
508 'user_name' => $user_name,
509 'user_email' => $user_email,
514 * Filters the default user variables used on the user sign-up form.
518 * @param array $signup_user_defaults {
519 * An array of default user variables.
521 * @type string $user_name The user username.
522 * @type string $user_email The user email address.
523 * @type WP_Error $errors A WP_Error object with possible errors relevant to the sign-up user.
526 $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults );
527 $user_name = $filtered_results['user_name'];
528 $user_email = $filtered_results['user_email'];
529 $errors = $filtered_results['errors'];
534 /* translators: %s: name of the network */
535 printf( __( 'Get your own %s account in seconds' ), get_network()->site_name );
537 <form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate">
538 <input type="hidden" name="stage" value="validate-user-signup" />
540 /** This action is documented in wp-signup.php */
541 do_action( 'signup_hidden_fields', 'validate-user' );
543 <?php show_user_form($user_name, $user_email, $errors); ?>
546 <?php if ( $active_signup == 'blog' ) { ?>
547 <input id="signupblog" type="hidden" name="signup_for" value="blog" />
548 <?php } elseif ( $active_signup == 'user' ) { ?>
549 <input id="signupblog" type="hidden" name="signup_for" value="user" />
551 <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
552 <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
554 <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
555 <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
559 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Next') ?>" /></p>
565 * Validate the new user signup
569 * @return bool True if new user signup was validated, false if error
571 function validate_user_signup() {
572 $result = validate_user_form();
573 $user_name = $result['user_name'];
574 $user_email = $result['user_email'];
575 $errors = $result['errors'];
577 if ( $errors->get_error_code() ) {
578 signup_user($user_name, $user_email, $errors);
582 if ( 'blog' == $_POST['signup_for'] ) {
583 signup_blog($user_name, $user_email);
587 /** This filter is documented in wp-signup.php */
588 wpmu_signup_user( $user_name, $user_email, apply_filters( 'add_signup_meta', array() ) );
590 confirm_user_signup($user_name, $user_email);
595 * New user signup confirmation
599 * @param string $user_name The username
600 * @param string $user_email The user's email address
602 function confirm_user_signup($user_name, $user_email) {
604 <h2><?php /* translators: %s: username */
605 printf( __( '%s is your new username' ), $user_name) ?></h2>
606 <p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
607 <p><?php /* translators: %s: email address */
608 printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p>
609 <p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
611 /** This action is documented in wp-signup.php */
612 do_action( 'signup_finished' );
616 * Setup the new site signup
620 * @param string $user_name The username.
621 * @param string $user_email The user's email address.
622 * @param string $blogname The site name.
623 * @param string $blog_title The site title.
624 * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string.
626 function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
627 if ( !is_wp_error($errors) )
628 $errors = new WP_Error();
630 $signup_blog_defaults = array(
631 'user_name' => $user_name,
632 'user_email' => $user_email,
633 'blogname' => $blogname,
634 'blog_title' => $blog_title,
639 * Filters the default site creation variables for the site sign-up form.
643 * @param array $signup_blog_defaults {
644 * An array of default site creation variables.
646 * @type string $user_name The user username.
647 * @type string $user_email The user email address.
648 * @type string $blogname The blogname.
649 * @type string $blog_title The title of the site.
650 * @type WP_Error $errors A WP_Error object with possible errors relevant to new site creation variables.
653 $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults );
655 $user_name = $filtered_results['user_name'];
656 $user_email = $filtered_results['user_email'];
657 $blogname = $filtered_results['blogname'];
658 $blog_title = $filtered_results['blog_title'];
659 $errors = $filtered_results['errors'];
661 if ( empty($blogname) )
662 $blogname = $user_name;
664 <form id="setupform" method="post" action="wp-signup.php">
665 <input type="hidden" name="stage" value="validate-blog-signup" />
666 <input type="hidden" name="user_name" value="<?php echo esc_attr($user_name) ?>" />
667 <input type="hidden" name="user_email" value="<?php echo esc_attr($user_email) ?>" />
669 /** This action is documented in wp-signup.php */
670 do_action( 'signup_hidden_fields', 'validate-site' );
672 <?php show_blog_form($blogname, $blog_title, $errors); ?>
673 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e('Signup') ?>" /></p>
679 * Validate new site signup
683 * @return bool True if the site signup was validated, false if error
685 function validate_blog_signup() {
686 // Re-validate user info.
687 $user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
688 $user_name = $user_result['user_name'];
689 $user_email = $user_result['user_email'];
690 $user_errors = $user_result['errors'];
692 if ( $user_errors->get_error_code() ) {
693 signup_user( $user_name, $user_email, $user_errors );
697 $result = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
698 $domain = $result['domain'];
699 $path = $result['path'];
700 $blogname = $result['blogname'];
701 $blog_title = $result['blog_title'];
702 $errors = $result['errors'];
704 if ( $errors->get_error_code() ) {
705 signup_blog($user_name, $user_email, $blogname, $blog_title, $errors);
709 $public = (int) $_POST['blog_public'];
710 $signup_meta = array ('lang_id' => 1, 'public' => $public);
712 // Handle the language setting for the new site.
713 if ( ! empty( $_POST['WPLANG'] ) ) {
715 $languages = signup_get_available_languages();
717 if ( in_array( $_POST['WPLANG'], $languages ) ) {
718 $language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
721 $signup_meta['WPLANG'] = $language;
727 /** This filter is documented in wp-signup.php */
728 $meta = apply_filters( 'add_signup_meta', $signup_meta );
730 wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
731 confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
736 * New site signup confirmation
740 * @param string $domain The domain URL
741 * @param string $path The site root path
742 * @param string $blog_title The new site title
743 * @param string $user_name The user's username
744 * @param string $user_email The user's email address
745 * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup()
747 function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
749 <h2><?php /* translators: %s: site address */
750 printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
752 <p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
753 <p><?php /* translators: %s: email address */
754 printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p>
755 <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
756 <h2><?php _e( 'Still waiting for your email?' ); ?></h2>
758 <?php _e( 'If you haven’t received your email yet, there are a number of things you can do:' ) ?>
759 <ul id="noemail-tips">
760 <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>
761 <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
763 /* translators: %s: email address */
764 printf( __( 'Have you entered your email correctly? You have entered %s, if it’s incorrect, you will not receive your email.' ), $user_email );
769 /** This action is documented in wp-signup.php */
770 do_action( 'signup_finished' );
774 * Retrieves languages available during the site/user signup process.
778 * @see get_available_languages()
780 * @return array List of available languages.
782 function signup_get_available_languages() {
784 * Filters the list of available languages for front-end site signups.
786 * Passing an empty array to this hook will disable output of the setting on the
787 * signup form, and the default language will be used when creating the site.
789 * Languages not already installed will be stripped.
793 * @param array $available_languages Available languages.
795 $languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() );
798 * Strip any non-installed languages and return.
800 * Re-call get_available_languages() here in case a language pack was installed
801 * in a callback hooked to the 'signup_get_available_languages' filter before this point.
803 return array_intersect_assoc( $languages, get_available_languages() );
807 $active_signup = get_site_option( 'registration', 'none' );
810 * Filters the type of site sign-up.
814 * @param string $active_signup String that returns registration type. The value can be
815 * 'all', 'none', 'blog', or 'user'.
817 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup );
819 // Make the signup type translatable.
820 $i18n_signup['all'] = _x('all', 'Multisite active signup type');
821 $i18n_signup['none'] = _x('none', 'Multisite active signup type');
822 $i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
823 $i18n_signup['user'] = _x('user', 'Multisite active signup type');
825 if ( is_super_admin() ) {
826 /* translators: 1: type of site sign-up; 2: network settings URL */
827 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>';
830 $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
832 $current_user = wp_get_current_user();
833 if ( $active_signup == 'none' ) {
834 _e( 'Registration has been disabled.' );
835 } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
836 $login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
837 /* translators: %s: login URL */
838 printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
840 $stage = isset( $_POST['stage'] ) ? $_POST['stage'] : 'default';
842 case 'validate-user-signup' :
843 if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' )
844 validate_user_signup();
846 _e( 'User registration has been disabled.' );
848 case 'validate-blog-signup':
849 if ( $active_signup == 'all' || $active_signup == 'blog' )
850 validate_blog_signup();
852 _e( 'Site registration has been disabled.' );
854 case 'gimmeanotherblog':
855 validate_another_blog_signup();
859 $user_email = isset( $_POST[ 'user_email' ] ) ? $_POST[ 'user_email' ] : '';
861 * Fires when the site sign-up form is sent.
865 do_action( 'preprocess_signup_form' );
866 if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
867 signup_another_blog($newblogname);
868 elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) )
869 signup_user( $newblogname, $user_email );
870 elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) )
871 _e( 'Sorry, new registrations are not allowed at this time.' );
873 _e( 'You are logged in already. No need to register again!' );
875 if ( $newblogname ) {
876 $newblog = get_blogaddress_by_name( $newblogname );
878 if ( $active_signup == 'blog' || $active_signup == 'all' )
879 /* translators: %s: site address */
880 printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',
881 '<strong>' . $newblog . '</strong>'
884 /* translators: %s: site address */
885 printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>',
886 '<strong>' . $newblog . '</strong>'
897 * Fires after the sign-up forms, before wp_footer.
901 do_action( 'after_signup_form' ); ?>
903 <?php get_footer( 'wp-signup' );