Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/17/2013 01:57:48 AM (11 years ago)
Author:
r-a-y
Message:

Clarify error message for a user attempting to register with capital
letters on a multisite install.

Because WP multisite does not allow a user to register with capital
letters, we need to do an explicit check for capital letters and throw
up a better error message to avoid confusion.

Fixes #5175.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-members/bp-members-functions.php

    r7348 r7382  
    11881188        $errors->add( 'user_name', __( 'That username is not allowed', 'buddypress' ) );
    11891189
    1190     if ( ! validate_username( $user_name ) )
    1191         $errors->add( 'user_name', __( 'Usernames can contain only letters, numbers, ., -, *, and @', 'buddypress' ) );
     1190    if ( ! validate_username( $user_name ) ) {
     1191        // Check for capital letters when on multisite.
     1192        //
     1193        // If so, throw a different error message.
     1194        // @see #5175
     1195        if ( is_multisite() ) {
     1196            $match = array();
     1197            preg_match( '/[A-Z]/', $user_name, $match );
     1198   
     1199            if ( ! empty( $match ) ) {
     1200                $errors->add( 'user_name', __( 'Username must be in lowercase characters.', 'buddypress' ) );
     1201            }
     1202
     1203        } else {
     1204            $errors->add( 'user_name', __( 'Usernames can contain only letters, numbers, ., -, *, and @', 'buddypress' ) );
     1205        }
     1206    }
    11921207
    11931208    if( strlen( $user_name ) < 4 )
Note: See TracChangeset for help on using the changeset viewer.