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.

Built from https://develop.svn.wordpress.org/trunk@35142


git-svn-id: http://core.svn.wordpress.org/trunk@35108 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2015-10-13 17:33:24 +00:00
parent ecd00c2618
commit a0bbd154d9
2 changed files with 5 additions and 10 deletions

View File

@ -413,7 +413,7 @@ function wpmu_validate_user_signup($user_name, $user_email) {
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
$errors->add( 'user_name', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
$errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers.' ) );
$user_name = $orig_username;
}
@ -440,9 +440,6 @@ function wpmu_validate_user_signup($user_name, $user_email) {
$errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
}
if ( strpos( $user_name, '_' ) !== false )
$errors->add( 'user_name', __( 'Sorry, usernames may not contain the character “_”!' ) );
// all numeric?
if ( preg_match( '/^[0-9]*$/', $user_name ) )
$errors->add('user_name', __('Sorry, usernames must have letters too!'));
@ -561,8 +558,9 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
if ( empty( $blogname ) )
$errors->add('blogname', __( 'Please enter a site name.' ) );
if ( preg_match( '/[^a-z0-9]+/', $blogname ) )
$errors->add('blogname', __( 'Only lowercase letters (a-z) and numbers are allowed.' ) );
if ( preg_match( '/[^a-z0-9]+/', $blogname ) ) {
$errors->add( 'blogname', __( 'Site names can only contain lowercase letters (a-z) and numbers.' ) );
}
if ( in_array( $blogname, $illegal_names ) )
$errors->add('blogname', __( 'That name is not allowed.' ) );
@ -570,9 +568,6 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
if ( strlen( $blogname ) < 4 && !is_super_admin() )
$errors->add('blogname', __( 'Site name must be at least 4 characters.' ) );
if ( strpos( $blogname, '_' ) !== false )
$errors->add( 'blogname', __( 'Sorry, site names may not contain the character &#8220;_&#8221;!' ) );
// do not allow users to create a blog that conflicts with a page on the main blog.
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 ) ) )
$errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-35141';
$wp_version = '4.4-alpha-35142';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.