Display the original username on the signup form on error, fixes #13124
git-svn-id: http://svn.automattic.com/wordpress/trunk@14298 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ce7b2b4f58
commit
7629767c24
|
@ -456,18 +456,21 @@ function wpmu_validate_user_signup($user_name, $user_email) {
|
||||||
|
|
||||||
$errors = new WP_Error();
|
$errors = new WP_Error();
|
||||||
|
|
||||||
|
$orig_username = $user_name;
|
||||||
$user_name = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
|
$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 || $user_name != $maybe[0] ) {
|
||||||
|
$errors->add( 'user_name', __( "Only the lowercase letters a-z and numbers allowed" ) );
|
||||||
|
$user_name = $orig_username;
|
||||||
|
}
|
||||||
|
|
||||||
$user_email = sanitize_email( $user_email );
|
$user_email = sanitize_email( $user_email );
|
||||||
|
|
||||||
if ( empty( $user_name ) )
|
if ( empty( $user_name ) )
|
||||||
$errors->add('user_name', __('Please enter a username'));
|
$errors->add('user_name', __('Please enter a username'));
|
||||||
|
|
||||||
$maybe = array();
|
|
||||||
preg_match( '/[a-z0-9]+/', $user_name, $maybe );
|
|
||||||
|
|
||||||
if ( $user_name != $maybe[0] )
|
|
||||||
$errors->add('user_name', __('Only lowercase letters and numbers allowed'));
|
|
||||||
|
|
||||||
$illegal_names = get_site_option( 'illegal_names' );
|
$illegal_names = get_site_option( 'illegal_names' );
|
||||||
if ( is_array( $illegal_names ) == false ) {
|
if ( is_array( $illegal_names ) == false ) {
|
||||||
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
|
$illegal_names = array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' );
|
||||||
|
@ -535,7 +538,7 @@ function wpmu_validate_user_signup($user_name, $user_email) {
|
||||||
$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
|
$errors->add('user_email', __('That email address has already been used. Please check your inbox for an activation email. It will become available in a couple of days if you do nothing.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array('user_name' => $user_name, 'user_email' => $user_email, 'errors' => $errors);
|
$result = array('user_name' => $user_name, 'orig_username' => $orig_username, 'user_email' => $user_email, 'errors' => $errors);
|
||||||
|
|
||||||
return apply_filters('wpmu_validate_user_signup', $result);
|
return apply_filters('wpmu_validate_user_signup', $result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue