Make WordPress Core

Ticket #47003: 47003.4.diff

File 47003.4.diff, 2.1 KB (added by garrett-eclipse, 4 years ago)

Refreshed patch to account for removal of Error prefixes in [48059]

  • src/wp-includes/ms-functions.php

     
    473473        $user_name     = preg_replace( '/\s+/', '', sanitize_user( $user_name, true ) );
    474474
    475475        if ( $user_name != $orig_username || preg_match( '/[^a-z0-9]/', $user_name ) ) {
    476                 $errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers.' ) );
     476                $errors->add( 'user_name', __( 'Usernames can only contain lowercase letters (a-z) and numbers (0-9).' ) );
    477477                $user_name = $orig_username;
    478478        }
    479479
  • src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php

     
    12461246                if ( ! validate_username( $username ) ) {
    12471247                        return new WP_Error(
    12481248                                'rest_user_invalid_username',
    1249                                 __( 'Username contains invalid characters.' ),
     1249                                __( 'Usernames can only contain lowercase letters (a-z) and numbers (0-9).' ),
    12501250                                array( 'status' => 400 )
    12511251                        );
    12521252                }
  • src/wp-includes/user.php

     
    25132513        if ( '' === $sanitized_user_login ) {
    25142514                $errors->add( 'empty_username', __( 'Please enter a username.' ) );
    25152515        } elseif ( ! validate_username( $user_login ) ) {
    2516                 $errors->add( 'invalid_username', __( 'This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
     2516                $errors->add( 'invalid_username', __( 'Usernames can only contain lowercase letters (a-z) and numbers (0-9).' ) );
    25172517                $sanitized_user_login = '';
    25182518        } elseif ( username_exists( $sanitized_user_login ) ) {
    25192519                $errors->add( 'username_exists', __( 'This username is already registered. Please choose another one.' ) );