wp/wp-signup.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
     5 
     5 
     6 add_action( 'wp_head', 'wp_no_robots' );
     6 add_action( 'wp_head', 'wp_no_robots' );
     7 
     7 
     8 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
     8 require( dirname( __FILE__ ) . '/wp-blog-header.php' );
     9 
     9 
    10 if ( is_array( get_site_option( 'illegal_names' )) && isset( $_GET[ 'new' ] ) && in_array( $_GET[ 'new' ], get_site_option( 'illegal_names' ) ) == true ) {
    10 nocache_headers();
       
    11 
       
    12 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() );
    13 	wp_redirect( network_home_url() );
    12 	die();
    14 	die();
    13 }
    15 }
    14 
    16 
    15 /**
    17 /**
    16  * Prints signup_header via wp_head
    18  * Prints signup_header via wp_head
    17  *
    19  *
    18  * @since MU
    20  * @since MU (3.0.0)
    19  */
    21  */
    20 function do_signup_header() {
    22 function do_signup_header() {
    21 	/**
    23 	/**
    22 	 * Fires within the head section of the site sign-up screen.
    24 	 * Fires within the head section of the site sign-up screen.
    23 	 *
    25 	 *
    26 	do_action( 'signup_header' );
    28 	do_action( 'signup_header' );
    27 }
    29 }
    28 add_action( 'wp_head', 'do_signup_header' );
    30 add_action( 'wp_head', 'do_signup_header' );
    29 
    31 
    30 if ( !is_multisite() ) {
    32 if ( !is_multisite() ) {
    31 	wp_redirect( site_url('wp-login.php?action=register') );
    33 	wp_redirect( wp_registration_url() );
    32 	die();
    34 	die();
    33 }
    35 }
    34 
    36 
    35 if ( !is_main_site() ) {
    37 if ( !is_main_site() ) {
    36 	wp_redirect( network_site_url( 'wp-signup.php' ) );
    38 	wp_redirect( network_site_url( 'wp-signup.php' ) );
    39 
    41 
    40 // Fix for page title
    42 // Fix for page title
    41 $wp_query->is_404 = false;
    43 $wp_query->is_404 = false;
    42 
    44 
    43 /**
    45 /**
       
    46  * Fires before the Site Signup page is loaded.
       
    47  *
       
    48  * @since 4.4.0
       
    49  */
       
    50 do_action( 'before_signup_header' );
       
    51 
       
    52 /**
    44  * Prints styles for front-end Multisite signup pages
    53  * Prints styles for front-end Multisite signup pages
    45  *
    54  *
    46  * @since MU
    55  * @since MU (3.0.0)
    47  */
    56  */
    48 function wpmu_signup_stylesheet() {
    57 function wpmu_signup_stylesheet() {
    49 	?>
    58 	?>
    50 	<style type="text/css">
    59 	<style type="text/css">
    51 		.mu_register { width: 90%; margin:0 auto; }
    60 		.mu_register { width: 90%; margin:0 auto; }
    54 		.mu_register input[type="submit"],
    63 		.mu_register input[type="submit"],
    55 			.mu_register #blog_title,
    64 			.mu_register #blog_title,
    56 			.mu_register #user_email,
    65 			.mu_register #user_email,
    57 			.mu_register #blogname,
    66 			.mu_register #blogname,
    58 			.mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }
    67 			.mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }
       
    68 		.mu_register #site-language { display: block; }
    59 		.mu_register .prefix_address,
    69 		.mu_register .prefix_address,
    60 			.mu_register .suffix_address {font-size: 18px;display:inline; }
    70 			.mu_register .suffix_address {font-size: 18px;display:inline; }
    61 		.mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; }
    71 		.mu_register label { font-weight:700; font-size:15px; display:block; margin:10px 0; }
    62 		.mu_register label.checkbox { display:inline; }
    72 		.mu_register label.checkbox { display:inline; }
    63 		.mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; }
    73 		.mu_register .mu_alert { font-weight:700; padding:10px; color:#333333; background:#ffffe0; border:1px solid #e6db55; }
    64 	</style>
    74 	</style>
    65 	<?php
    75 	<?php
    66 }
    76 }
    67 
    77 
    68 add_action( 'wp_head', 'wpmu_signup_stylesheet' );
    78 add_action( 'wp_head', 'wpmu_signup_stylesheet' );
    69 get_header();
    79 get_header( 'wp-signup' );
    70 
    80 
    71 /**
    81 /**
    72  * Fires before the site sign-up form.
    82  * Fires before the site sign-up form.
    73  *
    83  *
    74  * @since 3.0.0
    84  * @since 3.0.0
    75  */
    85  */
    76 do_action( 'before_signup_form' );
    86 do_action( 'before_signup_form' );
    77 ?>
    87 ?>
    78 <div id="content" class="widecolumn">
    88 <div id="signup-content" class="widecolumn">
    79 <div class="mu_register">
    89 <div class="mu_register wp-signup-container">
    80 <?php
    90 <?php
    81 /**
    91 /**
    82  * Generates and displays the Signup and Create Site forms
    92  * Generates and displays the Signup and Create Site forms
    83  *
    93  *
    84  * @since MU
    94  * @since MU (3.0.0)
    85  *
    95  *
    86  * @param string $blogname The new site name
    96  * @param string          $blogname   The new site name.
    87  * @param string $blog_title The new site title
    97  * @param string          $blog_title The new site title.
    88  * @param array $errors
    98  * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
    89  */
    99  */
    90 function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
   100 function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) {
    91 	$current_site = get_current_site();
   101 	if ( ! is_wp_error( $errors ) ) {
       
   102 		$errors = new WP_Error();
       
   103 	}
       
   104 
       
   105 	$current_network = get_network();
    92 	// Blog name
   106 	// Blog name
    93 	if ( !is_subdomain_install() )
   107 	if ( !is_subdomain_install() )
    94 		echo '<label for="blogname">' . __('Site Name:') . '</label>';
   108 		echo '<label for="blogname">' . __('Site Name:') . '</label>';
    95 	else
   109 	else
    96 		echo '<label for="blogname">' . __('Site Domain:') . '</label>';
   110 		echo '<label for="blogname">' . __('Site Domain:') . '</label>';
    98 	if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
   112 	if ( $errmsg = $errors->get_error_message('blogname') ) { ?>
    99 		<p class="error"><?php echo $errmsg ?></p>
   113 		<p class="error"><?php echo $errmsg ?></p>
   100 	<?php }
   114 	<?php }
   101 
   115 
   102 	if ( !is_subdomain_install() )
   116 	if ( !is_subdomain_install() )
   103 		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 />';
   117 		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 />';
   104 	else
   118 	else
   105 		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 />';
   119 		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 />';
   106 
   120 
   107 	if ( !is_user_logged_in() ) {
   121 	if ( ! is_user_logged_in() ) {
   108 		if ( !is_subdomain_install() )
   122 		if ( ! is_subdomain_install() ) {
   109 			$site = $current_site->domain . $current_site->path . __( 'sitename' );
   123 			$site = $current_network->domain . $current_network->path . __( 'sitename' );
   110 		else
   124 		} else {
   111 			$site = __( 'domain' ) . '.' . $site_domain . $current_site->path;
   125 			$site = __( 'domain' ) . '.' . $site_domain . $current_network->path;
   112 		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>';
   126 		}
       
   127 
       
   128 		/* translators: %s: site address */
       
   129 		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>';
   113 	}
   130 	}
   114 
   131 
   115 	// Blog Title
   132 	// Blog Title
   116 	?>
   133 	?>
   117 	<label for="blog_title"><?php _e('Site Title:') ?></label>
   134 	<label for="blog_title"><?php _e('Site Title:') ?></label>
   118 	<?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
   135 	<?php if ( $errmsg = $errors->get_error_message('blog_title') ) { ?>
   119 		<p class="error"><?php echo $errmsg ?></p>
   136 		<p class="error"><?php echo $errmsg ?></p>
   120 	<?php }
   137 	<?php }
   121 	echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />';
   138 	echo '<input name="blog_title" type="text" id="blog_title" value="'.esc_attr($blog_title).'" />';
   122 	?>
   139 	?>
       
   140 
       
   141 	<?php
       
   142 	// Site Language.
       
   143 	$languages = signup_get_available_languages();
       
   144 
       
   145 	if ( ! empty( $languages ) ) :
       
   146 		?>
       
   147 		<p>
       
   148 			<label for="site-language"><?php _e( 'Site Language:' ); ?></label>
       
   149 			<?php
       
   150 			// Network default.
       
   151 			$lang = get_site_option( 'WPLANG' );
       
   152 
       
   153 			if ( isset( $_POST['WPLANG'] ) ) {
       
   154 				$lang = $_POST['WPLANG'];
       
   155 			}
       
   156 
       
   157 			// Use US English if the default isn't available.
       
   158 			if ( ! in_array( $lang, $languages ) ) {
       
   159 				$lang = '';
       
   160 			}
       
   161 
       
   162 			wp_dropdown_languages( array(
       
   163 				'name'                        => 'WPLANG',
       
   164 				'id'                          => 'site-language',
       
   165 				'selected'                    => $lang,
       
   166 				'languages'                   => $languages,
       
   167 				'show_available_translations' => false,
       
   168 			) );
       
   169 			?>
       
   170 		</p>
       
   171 	<?php endif; // Languages. ?>
   123 
   172 
   124 	<div id="privacy">
   173 	<div id="privacy">
   125         <p class="privacy-intro">
   174         <p class="privacy-intro">
   126             <label for="blog_public_on"><?php _e('Privacy:') ?></label>
   175             <label for="blog_public_on"><?php _e('Privacy:') ?></label>
   127             <?php _e( 'Allow search engines to index this site.' ); ?>
   176             <?php _e( 'Allow search engines to index this site.' ); ?>
   141 	/**
   190 	/**
   142 	 * Fires after the site sign-up form.
   191 	 * Fires after the site sign-up form.
   143 	 *
   192 	 *
   144 	 * @since 3.0.0
   193 	 * @since 3.0.0
   145 	 *
   194 	 *
   146 	 * @param array $errors An array possibly containing 'blogname' or 'blog_title' errors.
   195 	 * @param WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
   147 	 */
   196 	 */
   148 	do_action( 'signup_blogform', $errors );
   197 	do_action( 'signup_blogform', $errors );
   149 }
   198 }
   150 
   199 
   151 /**
   200 /**
   152  * Validate the new site signup
   201  * Validate the new site signup
   153  *
   202  *
   154  * @since MU
   203  * @since MU (3.0.0)
   155  *
   204  *
   156  * @return array Contains the new site data and error messages.
   205  * @return array Contains the new site data and error messages.
   157  */
   206  */
   158 function validate_blog_form() {
   207 function validate_blog_form() {
   159 	$user = '';
   208 	$user = '';
   164 }
   213 }
   165 
   214 
   166 /**
   215 /**
   167  * Display user registration form
   216  * Display user registration form
   168  *
   217  *
   169  * @since MU
   218  * @since MU (3.0.0)
   170  *
   219  *
   171  * @param string $user_name The entered username
   220  * @param string          $user_name  The entered username.
   172  * @param string $user_email The entered email address
   221  * @param string          $user_email The entered email address.
   173  * @param array $errors
   222  * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
   174  */
   223  */
   175 function show_user_form($user_name = '', $user_email = '', $errors = '') {
   224 function show_user_form($user_name = '', $user_email = '', $errors = '') {
       
   225 	if ( ! is_wp_error( $errors ) ) {
       
   226 		$errors = new WP_Error();
       
   227 	}
       
   228 
   176 	// User name
   229 	// User name
   177 	echo '<label for="user_name">' . __('Username:') . '</label>';
   230 	echo '<label for="user_name">' . __('Username:') . '</label>';
   178 	if ( $errmsg = $errors->get_error_message('user_name') ) {
   231 	if ( $errmsg = $errors->get_error_message('user_name') ) {
   179 		echo '<p class="error">'.$errmsg.'</p>';
   232 		echo '<p class="error">'.$errmsg.'</p>';
   180 	}
   233 	}
   181 	echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr($user_name) .'" maxlength="60" /><br />';
   234 	echo '<input name="user_name" type="text" id="user_name" value="'. esc_attr( $user_name ) .'" autocapitalize="none" autocorrect="off" maxlength="60" /><br />';
   182 	_e( '(Must be at least 4 characters, letters and numbers only.)' );
   235 	_e( '(Must be at least 4 characters, letters and numbers only.)' );
   183 	?>
   236 	?>
   184 
   237 
   185 	<label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label>
   238 	<label for="user_email"><?php _e( 'Email&nbsp;Address:' ) ?></label>
   186 	<?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
   239 	<?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?>
   194 	/**
   247 	/**
   195 	 * Fires at the end of the user registration form on the site sign-up form.
   248 	 * Fires at the end of the user registration form on the site sign-up form.
   196 	 *
   249 	 *
   197 	 * @since 3.0.0
   250 	 * @since 3.0.0
   198 	 *
   251 	 *
   199 	 * @param array $errors An array possibly containing 'user_name' or 'user_email' errors.
   252 	 * @param WP_Error $errors A WP_Error object containing 'user_name' or 'user_email' errors.
   200 	 */
   253 	 */
   201 	do_action( 'signup_extra_fields', $errors );
   254 	do_action( 'signup_extra_fields', $errors );
   202 }
   255 }
   203 
   256 
   204 /**
   257 /**
   205  * Validate user signup name and email
   258  * Validate user signup name and email
   206  *
   259  *
   207  * @since MU
   260  * @since MU (3.0.0)
   208  *
   261  *
   209  * @return array Contains username, email, and error messages.
   262  * @return array Contains username, email, and error messages.
   210  */
   263  */
   211 function validate_user_form() {
   264 function validate_user_form() {
   212 	return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
   265 	return wpmu_validate_user_signup($_POST['user_name'], $_POST['user_email']);
   213 }
   266 }
   214 
   267 
   215 /**
   268 /**
   216  * Allow returning users to sign up for another site
   269  * Allow returning users to sign up for another site
   217  *
   270  *
   218  * @since MU
   271  * @since MU (3.0.0)
   219  *
   272  *
   220  * @param string $blogname The new site name
   273  * @param string          $blogname   The new site name
   221  * @param string $blog_title The new blog title
   274  * @param string          $blog_title The new site title.
   222  * @param array $errors
   275  * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
   223  */
   276  */
   224 function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
   277 function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) {
   225 	$current_user = wp_get_current_user();
   278 	$current_user = wp_get_current_user();
   226 
   279 
   227 	if ( ! is_wp_error($errors) ) {
   280 	if ( ! is_wp_error($errors) ) {
   233 		'blog_title' => $blog_title,
   286 		'blog_title' => $blog_title,
   234 		'errors'     => $errors
   287 		'errors'     => $errors
   235 	);
   288 	);
   236 
   289 
   237 	/**
   290 	/**
   238 	 * Filter the default site sign-up variables.
   291 	 * Filters the default site sign-up variables.
   239 	 *
   292 	 *
   240 	 * @since 3.0.0
   293 	 * @since 3.0.0
   241 	 *
   294 	 *
   242 	 * @param array $signup_defaults {
   295 	 * @param array $signup_defaults {
   243 	 *     An array of default site sign-up variables.
   296 	 *     An array of default site sign-up variables.
   244 	 *
   297 	 *
   245 	 *     @type string $blogname   The site blogname.
   298 	 *     @type string   $blogname   The site blogname.
   246 	 *     @type string $blog_title The site title.
   299 	 *     @type string   $blog_title The site title.
   247 	 *     @type array  $errors     An array possibly containing 'blogname' or 'blog_title' errors.
   300 	 *     @type WP_Error $errors     A WP_Error object possibly containing 'blogname' or 'blog_title' errors.
   248 	 * }
   301 	 * }
   249 	 */
   302 	 */
   250 	$filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
   303 	$filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults );
   251 
   304 
   252 	$blogname = $filtered_results['blogname'];
   305 	$blogname = $filtered_results['blogname'];
   253 	$blog_title = $filtered_results['blog_title'];
   306 	$blog_title = $filtered_results['blog_title'];
   254 	$errors = $filtered_results['errors'];
   307 	$errors = $filtered_results['errors'];
   255 
   308 
   256 	echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_current_site()->site_name ) . '</h2>';
   309 	echo '<h2>' . sprintf( __( 'Get <em>another</em> %s site in seconds' ), get_network()->site_name ) . '</h2>';
   257 
   310 
   258 	if ( $errors->get_error_code() ) {
   311 	if ( $errors->get_error_code() ) {
   259 		echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
   312 		echo '<p>' . __( 'There was a problem, please correct the form below and try again.' ) . '</p>';
   260 	}
   313 	}
   261 	?>
   314 	?>
   279 		<input type="hidden" name="stage" value="gimmeanotherblog" />
   332 		<input type="hidden" name="stage" value="gimmeanotherblog" />
   280 		<?php
   333 		<?php
   281 		/**
   334 		/**
   282 		 * Hidden sign-up form fields output when creating another site or user.
   335 		 * Hidden sign-up form fields output when creating another site or user.
   283 		 *
   336 		 *
   284 		 * @since MU
   337 		 * @since MU (3.0.0)
   285 		 *
   338 		 *
   286 		 * @param string $context A string describing the steps of the sign-up process. The value can be
   339 		 * @param string $context A string describing the steps of the sign-up process. The value can be
   287 		 *                        'create-another-site', 'validate-user', or 'validate-site'.
   340 		 *                        'create-another-site', 'validate-user', or 'validate-site'.
   288 		 */
   341 		 */
   289 		do_action( 'signup_hidden_fields', 'create-another-site' );
   342 		do_action( 'signup_hidden_fields', 'create-another-site' );
   293 	</form>
   346 	</form>
   294 	<?php
   347 	<?php
   295 }
   348 }
   296 
   349 
   297 /**
   350 /**
   298  * Validate a new blog signup
   351  * Validate a new site signup.
   299  *
   352  *
   300  * @since MU
   353  * @since MU (3.0.0)
   301  *
   354  *
   302  * @return null|boolean True if blog signup was validated, false if error.
   355  * @return null|bool True if site signup was validated, false if error.
   303  *                      The function halts all execution if the user is not logged in.
   356  *                   The function halts all execution if the user is not logged in.
   304  */
   357  */
   305 function validate_another_blog_signup() {
   358 function validate_another_blog_signup() {
   306 	global $wpdb, $blogname, $blog_title, $errors, $domain, $path;
   359 	global $blogname, $blog_title, $errors, $domain, $path;
   307 	$current_user = wp_get_current_user();
   360 	$current_user = wp_get_current_user();
   308 	if ( ! is_user_logged_in() ) {
   361 	if ( ! is_user_logged_in() ) {
   309 		die();
   362 		die();
   310 	}
   363 	}
   311 
   364 
   328 	$blog_meta_defaults = array(
   381 	$blog_meta_defaults = array(
   329 		'lang_id' => 1,
   382 		'lang_id' => 1,
   330 		'public'  => $public
   383 		'public'  => $public
   331 	);
   384 	);
   332 
   385 
       
   386 	// Handle the language setting for the new site.
       
   387 	if ( ! empty( $_POST['WPLANG'] ) ) {
       
   388 
       
   389 		$languages = signup_get_available_languages();
       
   390 
       
   391 		if ( in_array( $_POST['WPLANG'], $languages ) ) {
       
   392 			$language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
       
   393 
       
   394 			if ( $language ) {
       
   395 				$blog_meta_defaults['WPLANG'] = $language;
       
   396 			}
       
   397 		}
       
   398 
       
   399 	}
       
   400 
   333 	/**
   401 	/**
   334 	 * Filter the new site meta variables.
   402 	 * Filters the new site meta variables.
   335 	 *
   403 	 *
   336 	 * @since MU
   404 	 * Use the {@see 'add_signup_meta'} filter instead.
   337 	 * @deprecated 3.0.0 Use the 'add_signup_meta' filter instead.
   405 	 *
       
   406 	 * @since MU (3.0.0)
       
   407 	 * @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead.
   338 	 *
   408 	 *
   339 	 * @param array $blog_meta_defaults An array of default blog meta variables.
   409 	 * @param array $blog_meta_defaults An array of default blog meta variables.
   340 	 */
   410 	 */
   341 	$meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
   411 	$meta_defaults = apply_filters( 'signup_create_blog_meta', $blog_meta_defaults );
       
   412 
   342 	/**
   413 	/**
   343 	 * Filter the new default site meta variables.
   414 	 * Filters the new default site meta variables.
   344 	 *
   415 	 *
   345 	 * @since 3.0.0
   416 	 * @since 3.0.0
   346 	 *
   417 	 *
   347 	 * @param array $meta {
   418 	 * @param array $meta {
   348 	 *     An array of default site meta variables.
   419 	 *     An array of default site meta variables.
   351 	 *     @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
   422 	 *     @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
   352 	 * }
   423 	 * }
   353 	 */
   424 	 */
   354 	$meta = apply_filters( 'add_signup_meta', $meta_defaults );
   425 	$meta = apply_filters( 'add_signup_meta', $meta_defaults );
   355 
   426 
   356 	wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, $wpdb->siteid );
   427 	$blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, get_current_network_id() );
   357 	confirm_another_blog_signup($domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta);
   428 
       
   429 	if ( is_wp_error( $blog_id ) ) {
       
   430 		return false;
       
   431 	}
       
   432 
       
   433 	confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
   358 	return true;
   434 	return true;
   359 }
   435 }
   360 
   436 
   361 /**
   437 /**
   362  * Confirm a new site signup
   438  * Confirm a new site signup.
   363  *
   439  *
   364  * @since MU
   440  * @since MU (3.0.0)
   365  *
   441  * @since 4.4.0 Added the `$blog_id` parameter.
   366  * @param string $domain The domain URL
   442  *
   367  * @param string $path The site root path
   443  * @param string $domain     The domain URL.
   368  * @param string $user_name The username
   444  * @param string $path       The site root path.
   369  * @param string $user_email The user's email address
   445  * @param string $blog_title The site title.
   370  * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
   446  * @param string $user_name  The username.
   371  */
   447  * @param string $user_email The user's email address.
   372 function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array() ) {
   448  * @param array  $meta       Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup().
       
   449  * @param int    $blog_id    The site ID.
       
   450  */
       
   451 function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $user_email = '', $meta = array(), $blog_id = 0 ) {
       
   452 
       
   453 	if ( $blog_id ) {
       
   454 		switch_to_blog( $blog_id );
       
   455 		$home_url  = home_url( '/' );
       
   456 		$login_url = wp_login_url();
       
   457 		restore_current_blog();
       
   458 	} else {
       
   459 		$home_url  = 'http://' . $domain . $path;
       
   460 		$login_url = 'http://' . $domain . $path . 'wp-login.php';
       
   461 	}
       
   462 
       
   463 	$site = sprintf( '<a href="%1$s">%2$s</a>',
       
   464 		esc_url( $home_url ),
       
   465 		$blog_title
       
   466 	);
       
   467 
   373 	?>
   468 	?>
   374 	<h2><?php printf( __( 'The site %s is yours.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
   469 	<h2><?php
       
   470 		/* translators: %s: site name */
       
   471 		printf( __( 'The site %s is yours.' ), $site );
       
   472 	?></h2>
   375 	<p>
   473 	<p>
   376 		<?php printf( __( '<a href="http://%1$s">http://%2$s</a> is your new site. <a href="%3$s">Log in</a> as &#8220;%4$s&#8221; using your existing password.' ), $domain.$path, $domain.$path, "http://" . $domain.$path . "wp-login.php", $user_name ) ?>
   474 		<?php printf(
       
   475 			/* translators: 1: link to new site, 2: login URL, 3: username */
       
   476 			__( '%1$s is your new site. <a href="%2$s">Log in</a> as &#8220;%3$s&#8221; using your existing password.' ),
       
   477 			sprintf(
       
   478 				'<a href="%s">%s</a>',
       
   479 				esc_url( $home_url ),
       
   480 				untrailingslashit( $domain . $path )
       
   481 			),
       
   482 			esc_url( $login_url ),
       
   483 			$user_name
       
   484 		); ?>
   377 	</p>
   485 	</p>
   378 	<?php
   486 	<?php
   379 	/**
   487 	/**
   380 	 * Fires when the site or user sign-up process is complete.
   488 	 * Fires when the site or user sign-up process is complete.
   381 	 *
   489 	 *
   385 }
   493 }
   386 
   494 
   387 /**
   495 /**
   388  * Setup the new user signup process
   496  * Setup the new user signup process
   389  *
   497  *
   390  * @since MU
   498  * @since MU (3.0.0)
   391  *
   499  *
   392  * @param string $user_name The username
   500  * @param string          $user_name  The username.
   393  * @param string $user_email The user's email
   501  * @param string          $user_email The user's email.
   394  * @param array $errors
   502  * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
   395  */
   503  */
   396 function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
   504 function signup_user( $user_name = '', $user_email = '', $errors = '' ) {
   397 	global $active_signup;
   505 	global $active_signup;
   398 
   506 
   399 	if ( !is_wp_error($errors) )
   507 	if ( !is_wp_error($errors) )
   406 		'user_email' => $user_email,
   514 		'user_email' => $user_email,
   407 		'errors'     => $errors,
   515 		'errors'     => $errors,
   408 	);
   516 	);
   409 
   517 
   410 	/**
   518 	/**
   411 	 * Filter the default user variables used on the user sign-up form.
   519 	 * Filters the default user variables used on the user sign-up form.
   412 	 *
   520 	 *
   413 	 * @since 3.0.0
   521 	 * @since 3.0.0
   414 	 *
   522 	 *
   415 	 * @param array $signup_user_defaults {
   523 	 * @param array $signup_user_defaults {
   416 	 *     An array of default user variables.
   524 	 *     An array of default user variables.
   417 	 *
   525 	 *
   418 	 *     @type string $user_name  The user username.
   526 	 *     @type string   $user_name  The user username.
   419 	 *     @type string $user_email The user email address.
   527 	 *     @type string   $user_email The user email address.
   420 	 *     @type array  $errors     An array of possible errors relevant to the sign-up user.
   528 	 *     @type WP_Error $errors     A WP_Error object with possible errors relevant to the sign-up user.
   421 	 * }
   529 	 * }
   422 	 */
   530 	 */
   423 	$filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults );
   531 	$filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults );
   424 	$user_name = $filtered_results['user_name'];
   532 	$user_name = $filtered_results['user_name'];
   425 	$user_email = $filtered_results['user_email'];
   533 	$user_email = $filtered_results['user_email'];
   426 	$errors = $filtered_results['errors'];
   534 	$errors = $filtered_results['errors'];
   427 
   535 
   428 	?>
   536 	?>
   429 
   537 
   430 	<h2><?php printf( __( 'Get your own %s account in seconds' ), get_current_site()->site_name ) ?></h2>
   538 	<h2><?php
       
   539 		/* translators: %s: name of the network */
       
   540 		printf( __( 'Get your own %s account in seconds' ), get_network()->site_name );
       
   541 	?></h2>
   431 	<form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate">
   542 	<form id="setupform" method="post" action="wp-signup.php" novalidate="novalidate">
   432 		<input type="hidden" name="stage" value="validate-user-signup" />
   543 		<input type="hidden" name="stage" value="validate-user-signup" />
   433 		<?php
   544 		<?php
   434 		/** This action is documented in wp-signup.php */
   545 		/** This action is documented in wp-signup.php */
   435 		do_action( 'signup_hidden_fields', 'validate-user' );
   546 		do_action( 'signup_hidden_fields', 'validate-user' );
   456 }
   567 }
   457 
   568 
   458 /**
   569 /**
   459  * Validate the new user signup
   570  * Validate the new user signup
   460  *
   571  *
   461  * @since MU
   572  * @since MU (3.0.0)
   462  *
   573  *
   463  * @return bool True if new user signup was validated, false if error
   574  * @return bool True if new user signup was validated, false if error
   464  */
   575  */
   465 function validate_user_signup() {
   576 function validate_user_signup() {
   466 	$result = validate_user_form();
   577 	$result = validate_user_form();
   486 }
   597 }
   487 
   598 
   488 /**
   599 /**
   489  * New user signup confirmation
   600  * New user signup confirmation
   490  *
   601  *
   491  * @since MU
   602  * @since MU (3.0.0)
   492  *
   603  *
   493  * @param string $user_name The username
   604  * @param string $user_name The username
   494  * @param string $user_email The user's email address
   605  * @param string $user_email The user's email address
   495  */
   606  */
   496 function confirm_user_signup($user_name, $user_email) {
   607 function confirm_user_signup($user_name, $user_email) {
   497 	?>
   608 	?>
   498 	<h2><?php printf( __( '%s is your new username' ), $user_name) ?></h2>
   609 	<h2><?php /* translators: %s: username */
       
   610 	printf( __( '%s is your new username' ), $user_name) ?></h2>
   499 	<p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
   611 	<p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ) ?></p>
   500 	<p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ), $user_email ); ?></p>
   612 	<p><?php /* translators: %s: email address */
       
   613 	printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p>
   501 	<p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
   614 	<p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
   502 	<?php
   615 	<?php
   503 	/** This action is documented in wp-signup.php */
   616 	/** This action is documented in wp-signup.php */
   504 	do_action( 'signup_finished' );
   617 	do_action( 'signup_finished' );
   505 }
   618 }
   506 
   619 
   507 /**
   620 /**
   508  * Setup the new site signup
   621  * Setup the new site signup
   509  *
   622  *
   510  * @since MU
   623  * @since MU (3.0.0)
   511  *
   624  *
   512  * @param string $user_name The username
   625  * @param string          $user_name  The username.
   513  * @param string $user_email The user's email address
   626  * @param string          $user_email The user's email address.
   514  * @param string $blogname The site name
   627  * @param string          $blogname   The site name.
   515  * @param string $blog_title The site title
   628  * @param string          $blog_title The site title.
   516  * @param array $errors
   629  * @param WP_Error|string $errors     A WP_Error object containing existing errors. Defaults to empty string.
   517  */
   630  */
   518 function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
   631 function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') {
   519 	if ( !is_wp_error($errors) )
   632 	if ( !is_wp_error($errors) )
   520 		$errors = new WP_Error();
   633 		$errors = new WP_Error();
   521 
   634 
   526 		'blog_title' => $blog_title,
   639 		'blog_title' => $blog_title,
   527 		'errors'     => $errors
   640 		'errors'     => $errors
   528 	);
   641 	);
   529 
   642 
   530 	/**
   643 	/**
   531 	 * Filter the default site creation variables for the site sign-up form.
   644 	 * Filters the default site creation variables for the site sign-up form.
   532 	 *
   645 	 *
   533 	 * @since 3.0.0
   646 	 * @since 3.0.0
   534 	 *
   647 	 *
   535 	 * @param array $signup_blog_defaults {
   648 	 * @param array $signup_blog_defaults {
   536 	 *     An array of default site creation variables.
   649 	 *     An array of default site creation variables.
   537 	 *
   650 	 *
   538 	 *     @type string $user_name  The user username.
   651 	 *     @type string   $user_name  The user username.
   539 	 *     @type string $user_email The user email address.
   652 	 *     @type string   $user_email The user email address.
   540 	 *     @type string $blogname   The blogname.
   653 	 *     @type string   $blogname   The blogname.
   541 	 *     @type string $blog_title The title of the site.
   654 	 *     @type string   $blog_title The title of the site.
   542 	 *     @type array  $errors     An array of possible errors relevant to new site creation variables.
   655 	 *     @type WP_Error $errors     A WP_Error object with possible errors relevant to new site creation variables.
   543 	 * }
   656 	 * }
   544 	 */
   657 	 */
   545 	$filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults );
   658 	$filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults );
   546 
   659 
   547 	$user_name = $filtered_results['user_name'];
   660 	$user_name = $filtered_results['user_name'];
   568 }
   681 }
   569 
   682 
   570 /**
   683 /**
   571  * Validate new site signup
   684  * Validate new site signup
   572  *
   685  *
   573  * @since MU
   686  * @since MU (3.0.0)
   574  *
   687  *
   575  * @return bool True if the site signup was validated, false if error
   688  * @return bool True if the site signup was validated, false if error
   576  */
   689  */
   577 function validate_blog_signup() {
   690 function validate_blog_signup() {
   578 	// Re-validate user info.
   691 	// Re-validate user info.
   599 	}
   712 	}
   600 
   713 
   601 	$public = (int) $_POST['blog_public'];
   714 	$public = (int) $_POST['blog_public'];
   602 	$signup_meta = array ('lang_id' => 1, 'public' => $public);
   715 	$signup_meta = array ('lang_id' => 1, 'public' => $public);
   603 
   716 
       
   717 	// Handle the language setting for the new site.
       
   718 	if ( ! empty( $_POST['WPLANG'] ) ) {
       
   719 
       
   720 		$languages = signup_get_available_languages();
       
   721 
       
   722 		if ( in_array( $_POST['WPLANG'], $languages ) ) {
       
   723 			$language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );
       
   724 
       
   725 			if ( $language ) {
       
   726 				$signup_meta['WPLANG'] = $language;
       
   727 			}
       
   728 		}
       
   729 
       
   730 	}
       
   731 
   604 	/** This filter is documented in wp-signup.php */
   732 	/** This filter is documented in wp-signup.php */
   605 	$meta = apply_filters( 'add_signup_meta', $signup_meta );
   733 	$meta = apply_filters( 'add_signup_meta', $signup_meta );
   606 
   734 
   607 	wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
   735 	wpmu_signup_blog($domain, $path, $blog_title, $user_name, $user_email, $meta);
   608 	confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
   736 	confirm_blog_signup($domain, $path, $blog_title, $user_name, $user_email, $meta);
   610 }
   738 }
   611 
   739 
   612 /**
   740 /**
   613  * New site signup confirmation
   741  * New site signup confirmation
   614  *
   742  *
   615  * @since MU
   743  * @since MU (3.0.0)
   616  *
   744  *
   617  * @param string $domain The domain URL
   745  * @param string $domain The domain URL
   618  * @param string $path The site root path
   746  * @param string $path The site root path
   619  * @param string $blog_title The new site title
   747  * @param string $blog_title The new site title
   620  * @param string $user_name The user's username
   748  * @param string $user_name The user's username
   621  * @param string $user_email The user's email address
   749  * @param string $user_email The user's email address
   622  * @param array $meta Any additional meta from the 'add_signup_meta' filter in validate_blog_signup()
   750  * @param array $meta Any additional meta from the {@see 'add_signup_meta'} filter in validate_blog_signup()
   623  */
   751  */
   624 function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
   752 function confirm_blog_signup( $domain, $path, $blog_title, $user_name = '', $user_email = '', $meta = array() ) {
   625 	?>
   753 	?>
   626 	<h2><?php printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
   754 	<h2><?php /* translators: %s: site address */
       
   755 	printf( __( 'Congratulations! Your new site, %s, is almost ready.' ), "<a href='http://{$domain}{$path}'>{$blog_title}</a>" ) ?></h2>
   627 
   756 
   628 	<p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
   757 	<p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ) ?></p>
   629 	<p><?php printf( __( 'Check your inbox at <strong>%s</strong> and click the link given.' ),  $user_email) ?></p>
   758 	<p><?php /* translators: %s: email address */
       
   759 	printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' ); ?></p>
   630 	<p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
   760 	<p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
   631 	<h2><?php _e( 'Still waiting for your email?' ); ?></h2>
   761 	<h2><?php _e( 'Still waiting for your email?' ); ?></h2>
   632 	<p>
   762 	<p>
   633 		<?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?>
   763 		<?php _e( 'If you haven&#8217;t received your email yet, there are a number of things you can do:' ) ?>
   634 		<ul id="noemail-tips">
   764 		<ul id="noemail-tips">
   635 			<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>
   765 			<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>
   636 			<li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
   766 			<li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ) ?></p></li>
   637 			<li><?php printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email ) ?></li>
   767 			<li><?php
       
   768 				/* translators: %s: email address */
       
   769 				printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email );
       
   770 			?></li>
   638 		</ul>
   771 		</ul>
   639 	</p>
   772 	</p>
   640 	<?php
   773 	<?php
   641 	/** This action is documented in wp-signup.php */
   774 	/** This action is documented in wp-signup.php */
   642 	do_action( 'signup_finished' );
   775 	do_action( 'signup_finished' );
   643 }
   776 }
   644 
   777 
       
   778 /**
       
   779  * Retrieves languages available during the site/user signup process.
       
   780  *
       
   781  * @since 4.4.0
       
   782  *
       
   783  * @see get_available_languages()
       
   784  *
       
   785  * @return array List of available languages.
       
   786  */
       
   787 function signup_get_available_languages() {
       
   788 	/**
       
   789 	 * Filters the list of available languages for front-end site signups.
       
   790 	 *
       
   791 	 * Passing an empty array to this hook will disable output of the setting on the
       
   792 	 * signup form, and the default language will be used when creating the site.
       
   793 	 *
       
   794 	 * Languages not already installed will be stripped.
       
   795 	 *
       
   796 	 * @since 4.4.0
       
   797 	 *
       
   798 	 * @param array $available_languages Available languages.
       
   799 	 */
       
   800 	$languages = (array) apply_filters( 'signup_get_available_languages', get_available_languages() );
       
   801 
       
   802 	/*
       
   803 	 * Strip any non-installed languages and return.
       
   804 	 *
       
   805 	 * Re-call get_available_languages() here in case a language pack was installed
       
   806 	 * in a callback hooked to the 'signup_get_available_languages' filter before this point.
       
   807 	 */
       
   808 	return array_intersect_assoc( $languages, get_available_languages() );
       
   809 }
       
   810 
   645 // Main
   811 // Main
   646 $active_signup = get_site_option( 'registration', 'none' );
   812 $active_signup = get_site_option( 'registration', 'none' );
   647 /**
   813 
   648  * Filter the type of site sign-up.
   814 /**
       
   815  * Filters the type of site sign-up.
   649  *
   816  *
   650  * @since 3.0.0
   817  * @since 3.0.0
   651  *
   818  *
   652  * @param string $active_signup String that returns registration type. The value can be
   819  * @param string $active_signup String that returns registration type. The value can be
   653  *                              'all', 'none', 'blog', or 'user'.
   820  *                              'all', 'none', 'blog', or 'user'.
   654  */
   821  */
   655 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup );
   822 $active_signup = apply_filters( 'wpmu_active_signup', $active_signup );
   656 
   823 
   657 // Make the signup type translatable.
   824 if ( current_user_can( 'manage_network' ) ) {
   658 $i18n_signup['all'] = _x('all', 'Multisite active signup type');
   825 	echo '<div class="mu_alert">';
   659 $i18n_signup['none'] = _x('none', 'Multisite active signup type');
   826 	_e( 'Greetings Network Administrator!' );
   660 $i18n_signup['blog'] = _x('blog', 'Multisite active signup type');
   827 	echo ' ';
   661 $i18n_signup['user'] = _x('user', 'Multisite active signup type');
   828 
   662 
   829 	switch ( $active_signup ) {
   663 if ( is_super_admin() )
   830 		case 'none':
   664 	echo '<div class="mu_alert">' . sprintf( __( 'Greetings Site Administrator! You are currently allowing &#8220;%s&#8221; 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>';
   831 			_e( 'The network currently disallows registrations.' );
       
   832 			break;
       
   833 		case 'blog':
       
   834 			_e( 'The network currently allows site registrations.' );
       
   835 			break;
       
   836 		case 'user':
       
   837 			_e( 'The network currently allows user registrations.' );
       
   838 			break;
       
   839 		default:
       
   840 			_e( 'The network currently allows both site and user registrations.' );
       
   841 			break;
       
   842 	}
       
   843 
       
   844 	echo ' ';
       
   845 
       
   846 	/* translators: %s: network settings URL */
       
   847 	printf( __( 'To change or disable registration go to your <a href="%s">Options page</a>.' ), esc_url( network_admin_url( 'settings.php' ) ) );
       
   848 	echo '</div>';
       
   849 }
   665 
   850 
   666 $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
   851 $newblogname = isset($_GET['new']) ? strtolower(preg_replace('/^-|-$|[^-a-zA-Z0-9]/', '', $_GET['new'])) : null;
   667 
   852 
   668 $current_user = wp_get_current_user();
   853 $current_user = wp_get_current_user();
   669 if ( $active_signup == 'none' ) {
   854 if ( $active_signup == 'none' ) {
   670 	_e( 'Registration has been disabled.' );
   855 	_e( 'Registration has been disabled.' );
   671 } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
   856 } elseif ( $active_signup == 'blog' && !is_user_logged_in() ) {
   672 	$login_url = site_url( 'wp-login.php?redirect_to=' . urlencode( network_site_url( 'wp-signup.php' ) ) );
   857 	$login_url = wp_login_url( network_site_url( 'wp-signup.php' ) );
   673 	echo sprintf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
   858 	/* translators: %s: login URL */
       
   859 	printf( __( 'You must first <a href="%s">log in</a>, and then you can create a new site.' ), $login_url );
   674 } else {
   860 } else {
   675 	$stage = isset( $_POST['stage'] ) ?  $_POST['stage'] : 'default';
   861 	$stage = isset( $_POST['stage'] ) ?  $_POST['stage'] : 'default';
   676 	switch ( $stage ) {
   862 	switch ( $stage ) {
   677 		case 'validate-user-signup' :
   863 		case 'validate-user-signup' :
   678 			if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' )
   864 			if ( $active_signup == 'all' || $_POST[ 'signup_for' ] == 'blog' && $active_signup == 'blog' || $_POST[ 'signup_for' ] == 'user' && $active_signup == 'user' )
   698 			 * @since 3.0.0
   884 			 * @since 3.0.0
   699 			 */
   885 			 */
   700 			do_action( 'preprocess_signup_form' );
   886 			do_action( 'preprocess_signup_form' );
   701 			if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
   887 			if ( is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'blog' ) )
   702 				signup_another_blog($newblogname);
   888 				signup_another_blog($newblogname);
   703 			elseif ( is_user_logged_in() == false && ( $active_signup == 'all' || $active_signup == 'user' ) )
   889 			elseif ( ! is_user_logged_in() && ( $active_signup == 'all' || $active_signup == 'user' ) )
   704 				signup_user( $newblogname, $user_email );
   890 				signup_user( $newblogname, $user_email );
   705 			elseif ( is_user_logged_in() == false && ( $active_signup == 'blog' ) )
   891 			elseif ( ! is_user_logged_in() && ( $active_signup == 'blog' ) )
   706 				_e( 'Sorry, new registrations are not allowed at this time.' );
   892 				_e( 'Sorry, new registrations are not allowed at this time.' );
   707 			else
   893 			else
   708 				_e( 'You are logged in already. No need to register again!' );
   894 				_e( 'You are logged in already. No need to register again!' );
   709 
   895 
   710 			if ( $newblogname ) {
   896 			if ( $newblogname ) {
   711 				$newblog = get_blogaddress_by_name( $newblogname );
   897 				$newblog = get_blogaddress_by_name( $newblogname );
   712 
   898 
   713 				if ( $active_signup == 'blog' || $active_signup == 'all' )
   899 				if ( $active_signup == 'blog' || $active_signup == 'all' )
   714 					printf( '<p><em>' . __( 'The site you were looking for, <strong>%s</strong>, does not exist, but you can create it now!' ) . '</em></p>', $newblog );
   900 					/* translators: %s: site address */
       
   901 					printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist, but you can create it now!' ) . '</em></p>',
       
   902 						'<strong>' . $newblog . '</strong>'
       
   903 					);
   715 				else
   904 				else
   716 					printf( '<p><em>' . __( 'The site you were looking for, <strong>%s</strong>, does not exist.' ) . '</em></p>', $newblog );
   905 					/* translators: %s: site address */
       
   906 					printf( '<p><em>' . __( 'The site you were looking for, %s, does not exist.' ) . '</em></p>',
       
   907 						'<strong>' . $newblog . '</strong>'
       
   908 					);
   717 			}
   909 			}
   718 			break;
   910 			break;
   719 	}
   911 	}
   720 }
   912 }
   721 ?>
   913 ?>
   727  *
   919  *
   728  * @since 3.0.0
   920  * @since 3.0.0
   729  */
   921  */
   730 do_action( 'after_signup_form' ); ?>
   922 do_action( 'after_signup_form' ); ?>
   731 
   923 
   732 <?php get_footer(); ?>
   924 <?php get_footer( 'wp-signup' );