WordPress.org

Make WordPress Core

Changeset 19850


Ignore:
Timestamp:
02/07/2012 05:12:46 PM (6 years ago)
Author:
ryan
Message:

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

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-functions.php

    r19759 r19850  
    440440    preg_match( '/[a-z0-9]+/', $user_name, $maybe );
    441441
    442     if ( $user_name != $orig_username || $user_name != $maybe[0] ) {
     442    if ( $user_name != $orig_username || ( !empty( $maybe ) && $user_name != $maybe[0] ) ) {
    443443        $errors->add( 'user_name', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
    444444        $user_name = $orig_username;
  • trunk/wp-signup.php

    r19794 r19850  
    230230    if ( !is_wp_error($errors) )
    231231        $errors = new WP_Error();
    232     if ( isset( $_POST[ 'signup_for' ] ) )
    233         $signup[ esc_html( $_POST[ 'signup_for' ] ) ] = 'checked="checked"';
    234     else
    235         $signup[ 'blog' ] = 'checked="checked"';
    236 
    237     //TODO - This doesn't seem to do anything do we really need it?
    238     $signup['user'] = isset( $signup['user'] ) ? $signup['user'] : '';
     232
     233    $signup_for = isset( $_POST[ 'signup_for' ] ) ? esc_html( $_POST[ 'signup_for' ] ) : 'blog';
    239234
    240235    // allow definition of default variables
     
    258253            <input id="signupblog" type="hidden" name="signup_for" value="user" />
    259254        <?php } else { ?>
    260             <input id="signupblog" type="radio" name="signup_for" value="blog" <?php echo $signup['blog'] ?> />
     255            <input id="signupblog" type="radio" name="signup_for" value="blog" <?php checked( $signup_for, 'blog' ); ?> />
    261256            <label class="checkbox" for="signupblog"><?php _e('Gimme a site!') ?></label>
    262257            <br />
    263             <input id="signupuser" type="radio" name="signup_for" value="user" <?php echo $signup['user'] ?> />
     258            <input id="signupuser" type="radio" name="signup_for" value="user" <?php checked( $signup_for, 'user' ); ?> />
    264259            <label class="checkbox" for="signupuser"><?php _e('Just a username, please.') ?></label>
    265260        <?php } ?>
Note: See TracChangeset for help on using the changeset viewer.