41 |
41 |
42 // Fix for page title. |
42 // Fix for page title. |
43 $wp_query->is_404 = false; |
43 $wp_query->is_404 = false; |
44 |
44 |
45 /** |
45 /** |
46 * Fires before the Site Signup page is loaded. |
46 * Fires before the Site Sign-up page is loaded. |
47 * |
47 * |
48 * @since 4.4.0 |
48 * @since 4.4.0 |
49 */ |
49 */ |
50 do_action( 'before_signup_header' ); |
50 do_action( 'before_signup_header' ); |
51 |
51 |
52 /** |
52 /** |
53 * Prints styles for front-end Multisite signup pages |
53 * Prints styles for front-end Multisite Sign-up pages. |
54 * |
54 * |
55 * @since MU (3.0.0) |
55 * @since MU (3.0.0) |
56 */ |
56 */ |
57 function wpmu_signup_stylesheet() { |
57 function wpmu_signup_stylesheet() { |
58 ?> |
58 ?> |
77 |
77 |
78 add_action( 'wp_head', 'wpmu_signup_stylesheet' ); |
78 add_action( 'wp_head', 'wpmu_signup_stylesheet' ); |
79 get_header( 'wp-signup' ); |
79 get_header( 'wp-signup' ); |
80 |
80 |
81 /** |
81 /** |
82 * Fires before the site sign-up form. |
82 * Fires before the site Sign-up form. |
83 * |
83 * |
84 * @since 3.0.0 |
84 * @since 3.0.0 |
85 */ |
85 */ |
86 do_action( 'before_signup_form' ); |
86 do_action( 'before_signup_form' ); |
87 ?> |
87 ?> |
88 <div id="signup-content" class="widecolumn"> |
88 <div id="signup-content" class="widecolumn"> |
89 <div class="mu_register wp-signup-container" role="main"> |
89 <div class="mu_register wp-signup-container" role="main"> |
90 <?php |
90 <?php |
91 /** |
91 /** |
92 * Generates and displays the Signup and Create Site forms |
92 * Generates and displays the Sign-up and Create Site forms. |
93 * |
93 * |
94 * @since MU (3.0.0) |
94 * @since MU (3.0.0) |
95 * |
95 * |
96 * @param string $blogname The new site name. |
96 * @param string $blogname The new site name. |
97 * @param string $blog_title The new site title. |
97 * @param string $blog_title The new site title. |
116 <p class="error"><?php echo $errmsg; ?></p> |
116 <p class="error"><?php echo $errmsg; ?></p> |
117 <?php |
117 <?php |
118 } |
118 } |
119 |
119 |
120 if ( ! is_subdomain_install() ) { |
120 if ( ! is_subdomain_install() ) { |
121 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 />'; |
121 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" autocomplete="off" /><br />'; |
122 } else { |
122 } else { |
123 $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ); |
123 $site_domain = preg_replace( '|^www\.|', '', $current_network->domain ); |
124 echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" /><span class="suffix_address">.' . esc_html( $site_domain ) . '</span><br />'; |
124 echo '<input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" /><span class="suffix_address">.' . esc_html( $site_domain ) . '</span><br />'; |
125 } |
125 } |
126 |
126 |
127 if ( ! is_user_logged_in() ) { |
127 if ( ! is_user_logged_in() ) { |
128 if ( ! is_subdomain_install() ) { |
128 if ( ! is_subdomain_install() ) { |
129 $site = $current_network->domain . $current_network->path . __( 'sitename' ); |
129 $site = $current_network->domain . $current_network->path . __( 'sitename' ); |
258 echo '<label for="user_name">' . __( 'Username:' ) . '</label>'; |
258 echo '<label for="user_name">' . __( 'Username:' ) . '</label>'; |
259 $errmsg = $errors->get_error_message( 'user_name' ); |
259 $errmsg = $errors->get_error_message( 'user_name' ); |
260 if ( $errmsg ) { |
260 if ( $errmsg ) { |
261 echo '<p class="error">' . $errmsg . '</p>'; |
261 echo '<p class="error">' . $errmsg . '</p>'; |
262 } |
262 } |
263 echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" /><br />'; |
263 echo '<input name="user_name" type="text" id="user_name" value="' . esc_attr( $user_name ) . '" autocapitalize="none" autocorrect="off" maxlength="60" autocomplete="username" /><br />'; |
264 _e( '(Must be at least 4 characters, letters and numbers only.)' ); |
264 _e( '(Must be at least 4 characters, letters and numbers only.)' ); |
265 ?> |
265 ?> |
266 |
266 |
267 <label for="user_email"><?php _e( 'Email Address:' ); ?></label> |
267 <label for="user_email"><?php _e( 'Email Address:' ); ?></label> |
268 <?php |
268 <?php |
269 $errmsg = $errors->get_error_message( 'user_email' ); |
269 $errmsg = $errors->get_error_message( 'user_email' ); |
270 if ( $errmsg ) { |
270 if ( $errmsg ) { |
271 ?> |
271 ?> |
272 <p class="error"><?php echo $errmsg; ?></p> |
272 <p class="error"><?php echo $errmsg; ?></p> |
273 <?php } ?> |
273 <?php } ?> |
274 <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.)' ); ?> |
274 <input name="user_email" type="email" id="user_email" value="<?php echo esc_attr( $user_email ); ?>" maxlength="200" autocomplete="email" /><br /><?php _e( 'Your registration email is sent to this address. (Double-check your email address before continuing.)' ); ?> |
275 <?php |
275 <?php |
276 $errmsg = $errors->get_error_message( 'generic' ); |
276 $errmsg = $errors->get_error_message( 'generic' ); |
277 if ( $errmsg ) { |
277 if ( $errmsg ) { |
278 echo '<p class="error">' . $errmsg . '</p>'; |
278 echo '<p class="error">' . $errmsg . '</p>'; |
279 } |
279 } |
286 */ |
286 */ |
287 do_action( 'signup_extra_fields', $errors ); |
287 do_action( 'signup_extra_fields', $errors ); |
288 } |
288 } |
289 |
289 |
290 /** |
290 /** |
291 * Validate user signup name and email |
291 * Validates user sign-up name and email. |
292 * |
292 * |
293 * @since MU (3.0.0) |
293 * @since MU (3.0.0) |
294 * |
294 * |
295 * @return array Contains username, email, and error messages. |
295 * @return array Contains username, email, and error messages. |
296 * See wpmu_validate_user_signup() for details. |
296 * See wpmu_validate_user_signup() for details. |
298 function validate_user_form() { |
298 function validate_user_form() { |
299 return wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] ); |
299 return wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] ); |
300 } |
300 } |
301 |
301 |
302 /** |
302 /** |
303 * Allow returning users to sign up for another site |
303 * Shows a form for returning users to sign up for another site. |
304 * |
304 * |
305 * @since MU (3.0.0) |
305 * @since MU (3.0.0) |
306 * |
306 * |
307 * @param string $blogname The new site name |
307 * @param string $blogname The new site name |
308 * @param string $blog_title The new site title. |
308 * @param string $blog_title The new site title. |
371 } |
371 } |
372 ?> |
372 ?> |
373 </ul> |
373 </ul> |
374 <?php } ?> |
374 <?php } ?> |
375 |
375 |
376 <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> |
376 <p><?php _e( 'If you are not going to use a great site domain, leave it for a new user. Now have at it!' ); ?></p> |
377 <form id="setupform" method="post" action="wp-signup.php"> |
377 <form id="setupform" method="post" action="wp-signup.php"> |
378 <input type="hidden" name="stage" value="gimmeanotherblog" /> |
378 <input type="hidden" name="stage" value="gimmeanotherblog" /> |
379 <?php |
379 <?php |
380 /** |
380 /** |
381 * Hidden sign-up form fields output when creating another site or user. |
381 * Hidden sign-up form fields output when creating another site or user. |
392 </form> |
392 </form> |
393 <?php |
393 <?php |
394 } |
394 } |
395 |
395 |
396 /** |
396 /** |
397 * Validate a new site signup for an existing user. |
397 * Validates a new site sign-up for an existing user. |
398 * |
398 * |
399 * @global string $blogname The new site's subdomain or directory name. |
399 * @since MU (3.0.0) |
400 * @global string $blog_title The new site's title. |
400 * |
401 * @global WP_Error $errors Existing errors in the global scope. |
401 * @global string $blogname The new site's subdomain or directory name. |
402 * @global string $domain The new site's domain. |
402 * @global string $blog_title The new site's title. |
403 * @global string $path The new site's path. |
403 * @global WP_Error $errors Existing errors in the global scope. |
404 * |
404 * @global string $domain The new site's domain. |
405 * @since MU (3.0.0) |
405 * @global string $path The new site's path. |
406 * |
406 * |
407 * @return null|bool True if site signup was validated, false if error. |
407 * @return null|bool True if site signup was validated, false on error. |
408 * The function halts all execution if the user is not logged in. |
408 * The function halts all execution if the user is not logged in. |
409 */ |
409 */ |
410 function validate_another_blog_signup() { |
410 function validate_another_blog_signup() { |
411 global $blogname, $blog_title, $errors, $domain, $path; |
411 global $blogname, $blog_title, $errors, $domain, $path; |
412 $current_user = wp_get_current_user(); |
412 $current_user = wp_get_current_user(); |
484 confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id ); |
484 confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id ); |
485 return true; |
485 return true; |
486 } |
486 } |
487 |
487 |
488 /** |
488 /** |
489 * Confirm a new site signup. |
489 * Shows a message confirming that the new site has been created. |
490 * |
490 * |
491 * @since MU (3.0.0) |
491 * @since MU (3.0.0) |
492 * @since 4.4.0 Added the `$blog_id` parameter. |
492 * @since 4.4.0 Added the `$blog_id` parameter. |
493 * |
493 * |
494 * @param string $domain The domain URL. |
494 * @param string $domain The domain URL. |
551 /** |
551 /** |
552 * Shows a form for a visitor to sign up for a new user account. |
552 * Shows a form for a visitor to sign up for a new user account. |
553 * |
553 * |
554 * @since MU (3.0.0) |
554 * @since MU (3.0.0) |
555 * |
555 * |
|
556 * @global string $active_signup String that returns registration type. The value can be |
|
557 * 'all', 'none', 'blog', or 'user'. |
|
558 * |
556 * @param string $user_name The username. |
559 * @param string $user_name The username. |
557 * @param string $user_email The user's email. |
560 * @param string $user_email The user's email. |
558 * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. |
561 * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. |
559 */ |
562 */ |
560 function signup_user( $user_name = '', $user_email = '', $errors = '' ) { |
563 function signup_user( $user_name = '', $user_email = '', $errors = '' ) { |
624 </form> |
627 </form> |
625 <?php |
628 <?php |
626 } |
629 } |
627 |
630 |
628 /** |
631 /** |
629 * Validate the new user signup |
632 * Validates the new user sign-up. |
630 * |
633 * |
631 * @since MU (3.0.0) |
634 * @since MU (3.0.0) |
632 * |
635 * |
633 * @return bool True if new user signup was validated, false if error |
636 * @return bool True if new user sign-up was validated, false on error. |
634 */ |
637 */ |
635 function validate_user_signup() { |
638 function validate_user_signup() { |
636 $result = validate_user_form(); |
639 $result = validate_user_form(); |
637 $user_name = $result['user_name']; |
640 $user_name = $result['user_name']; |
638 $user_email = $result['user_email']; |
641 $user_email = $result['user_email']; |
654 confirm_user_signup( $user_name, $user_email ); |
657 confirm_user_signup( $user_name, $user_email ); |
655 return true; |
658 return true; |
656 } |
659 } |
657 |
660 |
658 /** |
661 /** |
659 * New user signup confirmation |
662 * Shows a message confirming that the new user has been registered and is awaiting activation. |
660 * |
663 * |
661 * @since MU (3.0.0) |
664 * @since MU (3.0.0) |
662 * |
665 * |
663 * @param string $user_name The username |
666 * @param string $user_name The username. |
664 * @param string $user_email The user's email address |
667 * @param string $user_email The user's email address. |
665 */ |
668 */ |
666 function confirm_user_signup( $user_name, $user_email ) { |
669 function confirm_user_signup( $user_name, $user_email ) { |
667 ?> |
670 ?> |
668 <h2> |
671 <h2> |
669 <?php |
672 <?php |
742 <?php |
745 <?php |
743 /** This action is documented in wp-signup.php */ |
746 /** This action is documented in wp-signup.php */ |
744 do_action( 'signup_hidden_fields', 'validate-site' ); |
747 do_action( 'signup_hidden_fields', 'validate-site' ); |
745 ?> |
748 ?> |
746 <?php show_blog_form( $blogname, $blog_title, $errors ); ?> |
749 <?php show_blog_form( $blogname, $blog_title, $errors ); ?> |
747 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Signup' ); ?>" /></p> |
750 <p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Sign up' ); ?>" /></p> |
748 </form> |
751 </form> |
749 <?php |
752 <?php |
750 } |
753 } |
751 |
754 |
752 /** |
755 /** |
753 * Validate new site signup |
756 * Validates new site signup. |
754 * |
757 * |
755 * @since MU (3.0.0) |
758 * @since MU (3.0.0) |
756 * |
759 * |
757 * @return bool True if the site signup was validated, false if error |
760 * @return bool True if the site sign-up was validated, false on error. |
758 */ |
761 */ |
759 function validate_blog_signup() { |
762 function validate_blog_signup() { |
760 // Re-validate user info. |
763 // Re-validate user info. |
761 $user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] ); |
764 $user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] ); |
762 $user_name = $user_result['user_name']; |
765 $user_name = $user_result['user_name']; |
837 ?> |
840 ?> |
838 </p> |
841 </p> |
839 <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p> |
842 <p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p> |
840 <h2><?php _e( 'Still waiting for your email?' ); ?></h2> |
843 <h2><?php _e( 'Still waiting for your email?' ); ?></h2> |
841 <p> |
844 <p> |
842 <?php _e( 'If you haven’t received your email yet, there are a number of things you can do:' ); ?> |
845 <?php _e( 'If you have not received your email yet, there are a number of things you can do:' ); ?> |
843 <ul id="noemail-tips"> |
846 <ul id="noemail-tips"> |
844 <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> |
847 <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> |
845 <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ); ?></p></li> |
848 <li><p><?php _e( 'Check the junk or spam folder of your email client. Sometime emails wind up there by mistake.' ); ?></p></li> |
846 <li> |
849 <li> |
847 <?php |
850 <?php |
855 /** This action is documented in wp-signup.php */ |
858 /** This action is documented in wp-signup.php */ |
856 do_action( 'signup_finished' ); |
859 do_action( 'signup_finished' ); |
857 } |
860 } |
858 |
861 |
859 /** |
862 /** |
860 * Retrieves languages available during the site/user signup process. |
863 * Retrieves languages available during the site/user sign-up process. |
861 * |
864 * |
862 * @since 4.4.0 |
865 * @since 4.4.0 |
863 * |
866 * |
864 * @see get_available_languages() |
867 * @see get_available_languages() |
865 * |
868 * |
866 * @return string[] Array of available language codes. Language codes are formed by |
869 * @return string[] Array of available language codes. Language codes are formed by |
867 * stripping the .mo extension from the language file names. |
870 * stripping the .mo extension from the language file names. |
868 */ |
871 */ |
869 function signup_get_available_languages() { |
872 function signup_get_available_languages() { |
870 /** |
873 /** |
871 * Filters the list of available languages for front-end site signups. |
874 * Filters the list of available languages for front-end site sign-ups. |
872 * |
875 * |
873 * Passing an empty array to this hook will disable output of the setting on the |
876 * Passing an empty array to this hook will disable output of the setting on the |
874 * signup form, and the default language will be used when creating the site. |
877 * sign-up form, and the default language will be used when creating the site. |
875 * |
878 * |
876 * Languages not already installed will be stripped. |
879 * Languages not already installed will be stripped. |
877 * |
880 * |
878 * @since 4.4.0 |
881 * @since 4.4.0 |
879 * |
882 * |