wp/wp-signup.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    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 	?>
    59 	<style type="text/css">
    59 	<style type="text/css">
    60 		.mu_register { width: 90%; margin:0 auto; }
    60 		.mu_register { width: 90%; margin: 0 auto; }
    61 		.mu_register form { margin-top: 2em; }
    61 		.mu_register form { margin-top: 2em; }
    62 		.mu_register .error { font-weight: 600; padding: 10px; color: #333333; background: #FFEBE8; border: 1px solid #CC0000; }
    62 		.mu_register fieldset,
       
    63 			.mu_register legend { margin: 0; padding: 0; border: none; }
       
    64 		.mu_register .error { font-weight: 600; padding: 10px; color: #333; background: #ffebe8; border: 1px solid #c00; }
    63 		.mu_register input[type="submit"],
    65 		.mu_register input[type="submit"],
    64 			.mu_register #blog_title,
    66 			.mu_register #blog_title,
    65 			.mu_register #user_email,
    67 			.mu_register #user_email,
    66 			.mu_register #blogname,
    68 			.mu_register #blogname,
    67 			.mu_register #user_name { width:100%; font-size: 24px; margin:5px 0; }
    69 			.mu_register #user_name { width: 100%; font-size: 24px; margin: 5px 0; box-sizing: border-box; }
    68 		.mu_register #site-language { display: block; }
    70 		.mu_register #site-language { display: block; }
    69 		.mu_register .prefix_address,
    71 		.mu_register .prefix_address,
    70 			.mu_register .suffix_address { font-size: 18px; display:inline; }
    72 			.mu_register .suffix_address { font-size: 18px; display: inline-block; direction: ltr; }
    71 		.mu_register label { font-weight: 600; font-size: 15px; display: block; margin: 10px 0; }
    73 		.mu_register label,
    72 		.mu_register label.checkbox { display:inline; }
    74 			.mu_register legend,
    73 		.mu_register .mu_alert { font-weight: 600; padding: 10px; color: #333333; background: #ffffe0; border: 1px solid #e6db55; }
    75 			.mu_register .label-heading { font-weight: 600; font-size: 15px; display: block; margin: 10px 0; }
       
    76 		.mu_register legend + p,
       
    77 			.mu_register input + p { margin-top: 0; }
       
    78 		.mu_register label.checkbox { display: inline; }
       
    79 		.mu_register .mu_alert { font-weight: 600; padding: 10px; color: #333; background: #ffffe0; border: 1px solid #e6db55; }
       
    80 		.mu_register .mu_alert a { color: inherit; text-decoration: underline; }
       
    81 		.mu_register .signup-options .wp-signup-radio-button { display: block; }
       
    82 		.mu_register .privacy-intro .wp-signup-radio-button { margin-right: 0.5em; }
       
    83 		.rtl .mu_register .wp-signup-blogname { direction: ltr; text-align: right; }
    74 	</style>
    84 	</style>
    75 	<?php
    85 	<?php
    76 }
    86 }
    77 
       
    78 add_action( 'wp_head', 'wpmu_signup_stylesheet' );
    87 add_action( 'wp_head', 'wpmu_signup_stylesheet' );
       
    88 
    79 get_header( 'wp-signup' );
    89 get_header( 'wp-signup' );
    80 
    90 
    81 /**
    91 /**
    82  * Fires before the site Sign-up form.
    92  * Fires before the site Sign-up form.
    83  *
    93  *
   101 	if ( ! is_wp_error( $errors ) ) {
   111 	if ( ! is_wp_error( $errors ) ) {
   102 		$errors = new WP_Error();
   112 		$errors = new WP_Error();
   103 	}
   113 	}
   104 
   114 
   105 	$current_network = get_network();
   115 	$current_network = get_network();
   106 	// Blog name.
   116 	// Site name.
   107 	if ( ! is_subdomain_install() ) {
   117 	if ( ! is_subdomain_install() ) {
   108 		echo '<label for="blogname">' . __( 'Site Name:' ) . '</label>';
   118 		echo '<label for="blogname">' . __( 'Site Name (subdirectory only):' ) . '</label>';
   109 	} else {
   119 	} else {
   110 		echo '<label for="blogname">' . __( 'Site Domain:' ) . '</label>';
   120 		echo '<label for="blogname">' . __( 'Site Domain (subdomain only):' ) . '</label>';
   111 	}
   121 	}
   112 
   122 
   113 	$errmsg = $errors->get_error_message( 'blogname' );
   123 	$errmsg_blogname      = $errors->get_error_message( 'blogname' );
   114 	if ( $errmsg ) {
   124 	$errmsg_blogname_aria = '';
   115 		?>
   125 	if ( $errmsg_blogname ) {
   116 		<p class="error"><?php echo $errmsg; ?></p>
   126 		$errmsg_blogname_aria = 'wp-signup-blogname-error ';
   117 		<?php
   127 		echo '<p class="error" id="wp-signup-blogname-error">' . $errmsg_blogname . '</p>';
   118 	}
   128 	}
   119 
   129 
   120 	if ( ! is_subdomain_install() ) {
   130 	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" autocomplete="off" /><br />';
   131 		echo '<div class="wp-signup-blogname"><span class="prefix_address" id="prefix-address">' . $current_network->domain . $current_network->path . '</span><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" required="required" aria-describedby="' . $errmsg_blogname_aria . 'prefix-address" /></div>';
   122 	} else {
   132 	} else {
   123 		$site_domain = preg_replace( '|^www\.|', '', $current_network->domain );
   133 		$site_domain = preg_replace( '|^www\.|', '', $current_network->domain );
   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 />';
   134 		echo '<div class="wp-signup-blogname"><input name="blogname" type="text" id="blogname" value="' . esc_attr( $blogname ) . '" maxlength="60" autocomplete="off" required="required" aria-describedby="' . $errmsg_blogname_aria . 'suffix-address" /><span class="suffix_address" id="suffix-address">.' . esc_html( $site_domain ) . '</span></div>';
   125 	}
   135 	}
   126 
   136 
   127 	if ( ! is_user_logged_in() ) {
   137 	if ( ! is_user_logged_in() ) {
   128 		if ( ! is_subdomain_install() ) {
   138 		if ( ! is_subdomain_install() ) {
   129 			$site = $current_network->domain . $current_network->path . __( 'sitename' );
   139 			$site = $current_network->domain . $current_network->path . __( 'sitename' );
   141 
   151 
   142 	// Site Title.
   152 	// Site Title.
   143 	?>
   153 	?>
   144 	<label for="blog_title"><?php _e( 'Site Title:' ); ?></label>
   154 	<label for="blog_title"><?php _e( 'Site Title:' ); ?></label>
   145 	<?php
   155 	<?php
   146 	$errmsg = $errors->get_error_message( 'blog_title' );
   156 	$errmsg_blog_title      = $errors->get_error_message( 'blog_title' );
   147 	if ( $errmsg ) {
   157 	$errmsg_blog_title_aria = '';
   148 		?>
   158 	if ( $errmsg_blog_title ) {
   149 		<p class="error"><?php echo $errmsg; ?></p>
   159 		$errmsg_blog_title_aria = ' aria-describedby="wp-signup-blog-title-error"';
   150 		<?php
   160 		echo '<p class="error" id="wp-signup-blog-title-error">' . $errmsg_blog_title . '</p>';
   151 	}
   161 	}
   152 	echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" autocomplete="off" />';
   162 	echo '<input name="blog_title" type="text" id="blog_title" value="' . esc_attr( $blog_title ) . '" required="required" autocomplete="off"' . $errmsg_blog_title_aria . ' />';
   153 	?>
   163 	?>
   154 
   164 
   155 	<?php
   165 	<?php
   156 	// Site Language.
   166 	// Site Language.
   157 	$languages = signup_get_available_languages();
   167 	$languages = signup_get_available_languages();
   195 		$blog_public_on_checked = 'checked="checked"';
   205 		$blog_public_on_checked = 'checked="checked"';
   196 	}
   206 	}
   197 	?>
   207 	?>
   198 
   208 
   199 	<div id="privacy">
   209 	<div id="privacy">
   200 		<p class="privacy-intro">
   210 		<fieldset class="privacy-intro">
   201 			<?php _e( 'Privacy:' ); ?>
   211 			<legend>
   202 			<?php _e( 'Allow search engines to index this site.' ); ?>
   212 				<span class="label-heading"><?php _e( 'Privacy:' ); ?></span>
   203 			<br style="clear:both" />
   213 				<?php _e( 'Allow search engines to index this site.' ); ?>
   204 			<label class="checkbox" for="blog_public_on">
   214 			</legend>
   205 				<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php echo $blog_public_on_checked; ?> />
   215 			<p class="wp-signup-radio-buttons">
   206 				<strong><?php _e( 'Yes' ); ?></strong>
   216 				<span class="wp-signup-radio-button">
   207 			</label>
   217 					<input type="radio" id="blog_public_on" name="blog_public" value="1" <?php echo $blog_public_on_checked; ?> />
   208 			<label class="checkbox" for="blog_public_off">
   218 					<label class="checkbox" for="blog_public_on"><?php _e( 'Yes' ); ?></label>
   209 				<input type="radio" id="blog_public_off" name="blog_public" value="0" <?php echo $blog_public_off_checked; ?> />
   219 				</span>
   210 				<strong><?php _e( 'No' ); ?></strong>
   220 				<span class="wp-signup-radio-button">
   211 			</label>
   221 					<input type="radio" id="blog_public_off" name="blog_public" value="0" <?php echo $blog_public_off_checked; ?> />
   212 		</p>
   222 					<label class="checkbox" for="blog_public_off"><?php _e( 'No' ); ?></label>
       
   223 				</span>
       
   224 			</p>
       
   225 		</fieldset>
   213 	</div>
   226 	</div>
   214 
   227 
   215 	<?php
   228 	<?php
   216 	/**
   229 	/**
   217 	 * Fires after the site sign-up form.
   230 	 * Fires after the site sign-up form.
   254 		$errors = new WP_Error();
   267 		$errors = new WP_Error();
   255 	}
   268 	}
   256 
   269 
   257 	// Username.
   270 	// Username.
   258 	echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
   271 	echo '<label for="user_name">' . __( 'Username:' ) . '</label>';
   259 	$errmsg = $errors->get_error_message( 'user_name' );
   272 	$errmsg_username      = $errors->get_error_message( 'user_name' );
   260 	if ( $errmsg ) {
   273 	$errmsg_username_aria = '';
   261 		echo '<p class="error">' . $errmsg . '</p>';
   274 	if ( $errmsg_username ) {
   262 	}
   275 		$errmsg_username_aria = 'wp-signup-username-error ';
   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 />';
   276 		echo '<p class="error" id="wp-signup-username-error">' . $errmsg_username . '</p>';
   264 	_e( '(Must be at least 4 characters, letters and numbers only.)' );
   277 	}
   265 	?>
   278 	?>
   266 
   279 	<input name="user_name" type="text" id="user_name" value="<?php echo esc_attr( $user_name ); ?>" autocapitalize="none" autocorrect="off" maxlength="60" autocomplete="username" required="required" aria-describedby="<?php echo $errmsg_username_aria; ?>wp-signup-username-description" />
   267 	<label for="user_email"><?php _e( 'Email&nbsp;Address:' ); ?></label>
   280 	<p id="wp-signup-username-description"><?php _e( '(Must be at least 4 characters, lowercase letters and numbers only.)' ); ?></p>
   268 	<?php
   281 
   269 	$errmsg = $errors->get_error_message( 'user_email' );
   282 	<?php
   270 	if ( $errmsg ) {
   283 	// Email address.
   271 		?>
   284 	echo '<label for="user_email">' . __( 'Email&nbsp;Address:' ) . '</label>';
   272 		<p class="error"><?php echo $errmsg; ?></p>
   285 	$errmsg_email      = $errors->get_error_message( 'user_email' );
   273 	<?php } ?>
   286 	$errmsg_email_aria = '';
   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.)' ); ?>
   287 	if ( $errmsg_email ) {
   275 	<?php
   288 		$errmsg_email_aria = 'wp-signup-email-error ';
   276 	$errmsg = $errors->get_error_message( 'generic' );
   289 		echo '<p class="error" id="wp-signup-email-error">' . $errmsg_email . '</p>';
   277 	if ( $errmsg ) {
   290 	}
   278 		echo '<p class="error">' . $errmsg . '</p>';
   291 	?>
       
   292 	<input name="user_email" type="email" id="user_email" value="<?php echo esc_attr( $user_email ); ?>" maxlength="200" autocomplete="email" required="required" aria-describedby="<?php echo $errmsg_email_aria; ?>wp-signup-email-description" />
       
   293 	<p id="wp-signup-email-description"><?php _e( 'Your registration email is sent to this address. (Double-check your email address before continuing.)' ); ?></p>
       
   294 
       
   295 	<?php
       
   296 	// Extra fields.
       
   297 	$errmsg_generic = $errors->get_error_message( 'generic' );
       
   298 	if ( $errmsg_generic ) {
       
   299 		echo '<p class="error" id="wp-signup-generic-error">' . $errmsg_generic . '</p>';
   279 	}
   300 	}
   280 	/**
   301 	/**
   281 	 * Fires at the end of the new user account registration form.
   302 	 * Fires at the end of the new user account registration form.
   282 	 *
   303 	 *
   283 	 * @since 3.0.0
   304 	 * @since 3.0.0
   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>
   397 	<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">
   398 	<form id="setupform" method="post" action="wp-signup.php">
   378 		<input type="hidden" name="stage" value="gimmeanotherblog" />
   399 		<input type="hidden" name="stage" value="gimmeanotherblog" />
   379 		<?php
   400 		<?php
   380 		/**
   401 		/**
   381 		 * Hidden sign-up form fields output when creating another site or user.
   402 		 * Fires when hidden sign-up form fields output when creating another site or user.
   382 		 *
   403 		 *
   383 		 * @since MU (3.0.0)
   404 		 * @since MU (3.0.0)
   384 		 *
   405 		 *
   385 		 * @param string $context A string describing the steps of the sign-up process. The value can be
   406 		 * @param string $context A string describing the steps of the sign-up process. The value can be
   386 		 *                        'create-another-site', 'validate-user', or 'validate-site'.
   407 		 *                        'create-another-site', 'validate-user', or 'validate-site'.
   607 		/** This action is documented in wp-signup.php */
   628 		/** This action is documented in wp-signup.php */
   608 		do_action( 'signup_hidden_fields', 'validate-user' );
   629 		do_action( 'signup_hidden_fields', 'validate-user' );
   609 		?>
   630 		?>
   610 		<?php show_user_form( $user_name, $user_email, $errors ); ?>
   631 		<?php show_user_form( $user_name, $user_email, $errors ); ?>
   611 
   632 
   612 		<p>
   633 		<?php if ( 'blog' === $active_signup ) : ?>
   613 		<?php if ( 'blog' === $active_signup ) { ?>
       
   614 			<input id="signupblog" type="hidden" name="signup_for" value="blog" />
   634 			<input id="signupblog" type="hidden" name="signup_for" value="blog" />
   615 		<?php } elseif ( 'user' === $active_signup ) { ?>
   635 		<?php elseif ( 'user' === $active_signup ) : ?>
   616 			<input id="signupblog" type="hidden" name="signup_for" value="user" />
   636 			<input id="signupblog" type="hidden" name="signup_for" value="user" />
   617 		<?php } else { ?>
   637 		<?php else : ?>
   618 			<input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
   638 			<fieldset class="signup-options">
   619 			<label class="checkbox" for="signupblog"><?php _e( 'Gimme a site!' ); ?></label>
   639 				<legend><?php _e( 'Create a site or only a username:' ); ?></legend>
   620 			<br />
   640 				<p class="wp-signup-radio-buttons">
   621 			<input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
   641 					<span class="wp-signup-radio-button">
   622 			<label class="checkbox" for="signupuser"><?php _e( 'Just a username, please.' ); ?></label>
   642 						<input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
   623 		<?php } ?>
   643 						<label class="checkbox" for="signupblog"><?php _e( 'Gimme a site!' ); ?></label>
   624 		</p>
   644 					</span>
       
   645 					<span class="wp-signup-radio-button">
       
   646 						<input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
       
   647 						<label class="checkbox" for="signupuser"><?php _e( 'Just a username, please.' ); ?></label>
       
   648 					</span>
       
   649 				</p>
       
   650 			</fieldset>
       
   651 		<?php endif; ?>
   625 
   652 
   626 		<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Next' ); ?>" /></p>
   653 		<p class="submit"><input type="submit" name="submit" class="submit" value="<?php esc_attr_e( 'Next' ); ?>" /></p>
   627 	</form>
   654 	</form>
   628 	<?php
   655 	<?php
   629 }
   656 }
   675 	?>
   702 	?>
   676 	</h2>
   703 	</h2>
   677 	<p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ); ?></p>
   704 	<p><?php _e( 'But, before you can start using your new username, <strong>you must activate it</strong>.' ); ?></p>
   678 	<p>
   705 	<p>
   679 	<?php
   706 	<?php
   680 	/* translators: %s: Email address. */
   707 	/* translators: %s: The user email address. */
   681 	printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' );
   708 	printf( __( 'Check your inbox at %s and click on the given link.' ), '<strong>' . $user_email . '</strong>' );
   682 	?>
   709 	?>
   683 	</p>
   710 	</p>
   684 	<p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
   711 	<p><?php _e( 'If you do not activate your username within two days, you will have to sign up again.' ); ?></p>
   685 	<?php
   712 	<?php
   686 	/** This action is documented in wp-signup.php */
   713 	/** This action is documented in wp-signup.php */
   833 	</h2>
   860 	</h2>
   834 
   861 
   835 	<p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ); ?></p>
   862 	<p><?php _e( 'But, before you can start using your site, <strong>you must activate it</strong>.' ); ?></p>
   836 	<p>
   863 	<p>
   837 	<?php
   864 	<?php
   838 	/* translators: %s: Email address. */
   865 	/* translators: %s: The user email address. */
   839 	printf( __( 'Check your inbox at %s and click the link given.' ), '<strong>' . $user_email . '</strong>' );
   866 	printf( __( 'Check your inbox at %s and click on the given link.' ), '<strong>' . $user_email . '</strong>' );
   840 	?>
   867 	?>
   841 	</p>
   868 	</p>
   842 	<p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
   869 	<p><?php _e( 'If you do not activate your site within two days, you will have to sign up again.' ); ?></p>
   843 	<h2><?php _e( 'Still waiting for your email?' ); ?></h2>
   870 	<h2><?php _e( 'Still waiting for your email?' ); ?></h2>
   844 	<p>
   871 	<p><?php _e( 'If you have not received your email yet, there are a number of things you can do:' ); ?></p>
   845 		<?php _e( 'If you have not received your email yet, there are a number of things you can do:' ); ?>
   872 	<ul id="noemail-tips">
   846 		<ul id="noemail-tips">
   873 		<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>
   874 		<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>
   875 		<li>
   849 			<li>
   876 		<?php
   850 			<?php
   877 			/* translators: %s: Email address. */
   851 				/* translators: %s: Email address. */
   878 			printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email );
   852 				printf( __( 'Have you entered your email correctly? You have entered %s, if it&#8217;s incorrect, you will not receive your email.' ), $user_email );
   879 		?>
   853 			?>
   880 		</li>
   854 			</li>
   881 	</ul>
   855 		</ul>
       
   856 	</p>
       
   857 	<?php
   882 	<?php
   858 	/** This action is documented in wp-signup.php */
   883 	/** This action is documented in wp-signup.php */
   859 	do_action( 'signup_finished' );
   884 	do_action( 'signup_finished' );
   860 }
   885 }
   861 
   886