Skip to content
Browse files

Fix notices. Simplify checkbox logic. Props SergeyBiryukov. fixes #19670

git-svn-id: http://svn.automattic.com/wordpress/trunk@19850 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent 5722423 commit 1438d033307ad692bfd708dce869eb17bbe30296 ryan committed Feb 7, 2012
Showing with 4 additions and 9 deletions.
  1. +1 −1 wp-includes/ms-functions.php
  2. +3 −8 wp-signup.php
View
2 wp-includes/ms-functions.php
@@ -439,7 +439,7 @@ function wpmu_validate_user_signup($user_name, $user_email) {
$maybe = array();
preg_match( '/[a-z0-9]+/', $user_name, $maybe );
- if ( $user_name != $orig_username || $user_name != $maybe[0] ) {
+ if ( $user_name != $orig_username || ( !empty( $maybe ) && $user_name != $maybe[0] ) ) {
$errors->add( 'user_name', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
$user_name = $orig_username;
}
View
11 wp-signup.php
@@ -229,13 +229,8 @@ function signup_user($user_name = '', $user_email = '', $errors = '') {
if ( !is_wp_error($errors) )
$errors = new WP_Error();
- if ( isset( $_POST[ 'signup_for' ] ) )
- $signup[ esc_html( $_POST[ 'signup_for' ] ) ] = 'checked="checked"';
- else
- $signup[ 'blog' ] = 'checked="checked"';
- //TODO - This doesn't seem to do anything do we really need it?
- $signup['user'] = isset( $signup['user'] ) ? $signup['user'] : '';
+ $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
// allow definition of default variables
$filtered_results = apply_filters('signup_user_init', array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors ));
@@ -257,10 +252,10 @@ function signup_user($user_name = '', $user_email = '', $errors = '') {
<?php } elseif ( $active_signup == 'user' ) { ?>
<input id="signupblog" type="hidden" name="signup_for" value="user" />
<?php } else { ?>
- <input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup['blog'] ?> />
+ <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
<label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
<br />
- <input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup['user'] ?> />
+ <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
<label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
<?php } ?>
</p>

0 comments on commit 1438d03

Please sign in to comment.
Something went wrong with that request. Please try again.