Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/20/2010 12:34:32 AM (15 years ago)
Author:
apeatling
Message:

Run username through validate_username() check on signup. Fixes #1992

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-core/bp-core-wpabstraction.php

    r2349 r2752  
    9797        $errors = new WP_Error();
    9898
    99         $user_name = preg_replace( "/\s+/", '', sanitize_user( $user_name, true ) );
    10099        $user_email = sanitize_email( $user_email );
    101100
     
    106105        preg_match( "/[a-z0-9]+/", $user_name, $maybe );
    107106
    108         if( $user_name != $maybe[0] ) {
    109             $errors->add('user_name', __("Only lowercase letters and numbers allowed"));
    110         }
    111 
    112107        $illegal_names = get_site_option( "illegal_names" );
    113108        if( is_array( $illegal_names ) == false ) {
     
    115110            add_site_option( "illegal_names", $illegal_names );
    116111        }
    117         if( in_array( $user_name, $illegal_names ) == true ) {
    118             $errors->add('user_name',  __("That username is not allowed"));
     112
     113        if ( !validate_username( $user_name ) || in_array( $user_name, $illegal_names ) == true || $user_name != $maybe[0] ) {
     114            $errors->add('user_name', __("Only lowercase letters and numbers allowed"));
    119115        }
    120116
Note: See TracChangeset for help on using the changeset viewer.