Simplify matching code. see #19670.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19852 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2012-02-07 17:44:29 +00:00
parent f66cb09abc
commit 86596214bd
1 changed files with 1 additions and 3 deletions

View File

@ -436,10 +436,8 @@ function wpmu_validate_user_signup($user_name, $user_email) {
$orig_username = $user_name;
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
$maybe = array();
preg_match( '/[a-z0-9]+/', $user_name, $maybe );
if ( $user_name != $orig_username || ( !empty( $maybe ) && $user_name != $maybe[0] ) ) {
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.' ) );
$user_name = $orig_username;
}