Make WordPress Core


Ignore:
Timestamp:
10/13/2015 05:32:17 PM (9 years ago)
Author:
DrewAPicture
Message:

Multisite: Improve two error strings specifying allowed characters in usernames and site names.

Also removes two error strings that were likely never being triggered anyway due to the stricter character matching higher up.

Props atomicjack, bjornjohansen, DrewAPicture.
Fixes #33336.

File:
1 edited

Legend:

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

    r35024 r35142  
    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    }
     
    440440        $errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
    441441    }
    442 
    443     if ( strpos( $user_name, '_' ) !== false )
    444         $errors->add( 'user_name', __( 'Sorry, usernames may not contain the character “_”!' ) );
    445442
    446443    // all numeric?
     
    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 ) )
     
    570568    if ( strlen( $blogname ) < 4 && !is_super_admin() )
    571569        $errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
    572 
    573     if ( strpos( $blogname, '_' ) !== false )
    574         $errors->add( 'blogname', __( 'Sorry, site names may not contain the character &#8220;_&#8221;!' ) );
    575570
    576571    // do not allow users to create a blog that conflicts with a page on the main blog.
Note: See TracChangeset for help on using the changeset viewer.