WordPress.org

Make WordPress Core

Ticket #33336: 33336.3.diff

File 33336.3.diff, 2.2 KB (added by DrewAPicture, 6 years ago)
  • src/wp-includes/ms-functions.php

     
    413413        $user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
    414414
    415415        if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
    416                 $errors->add( 'user_name', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
     416                $errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers.' ) );
    417417                $user_name = $orig_username;
    418418        }
    419419
     
    440440                $errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
    441441        }
    442442
    443         if ( strpos( $user_name, '_' ) !== false )
    444                 $errors->add( 'user_name', __( 'Sorry, usernames may not contain the character “_”!' ) );
    445 
    446443        // all numeric?
    447444        if ( preg_match( '/^[0-9]*$/', $user_name ) )
    448445                $errors->add('user_name', __('Sorry, usernames must have letters too!'));
     
    561558        if ( empty( $blogname ) )
    562559                $errors->add('blogname', __( 'Please enter a site name.' ) );
    563560
    564         if ( preg_match( '/[^a-z0-9]+/', $blogname ) )
    565                 $errors->add('blogname', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
     561        if ( preg_match( '/[^a-z0-9]+/', $blogname ) ) {
     562                $errors->add( 'blogname', __( 'Site names can only contain lowercase letters (a-z) and numbers.' ) );
     563        }
    566564
    567565        if ( in_array( $blogname, $illegal_names ) )
    568566                $errors->add('blogname',  __( 'That name is not allowed.' ) );
     
    570568        if ( strlen( $blogname ) < 4 && !is_super_admin() )
    571569                $errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
    572570
    573         if ( strpos( $blogname, '_' ) !== false )
    574                 $errors->add( 'blogname', __( 'Sorry, site names may not contain the character &#8220;_&#8221;!' ) );
    575 
    576571        // do not allow users to create a blog that conflicts with a page on the main blog.
    577572        if ( !is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( "SELECT post_name FROM " . $wpdb->get_blog_prefix( $current_site->blog_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) )
    578573                $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );