Skip to:
Content

BuddyPress.org

Changeset 2928


Ignore:
Timestamp:
04/15/2010 02:49:35 PM (11 years ago)
Author:
johnjamesjacoby
Message:

Fixes #2310 props faisalzulfiqar

File:
1 edited

Legend:

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

    r2859 r2928  
    252252
    253253    if ( empty( $user_name ) )
    254         $errors->add( 'user_name', __( 'Please enter a username', 'buddypress' ) );
     254        $errors->add( 'user_name', __( 'Please enter a username', 'buddypress' ) );
    255255
    256256    $maybe = array();
     
    260260    $filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator', BP_GROUPS_SLUG, BP_MEMBERS_SLUG, BP_FORUMS_SLUG, BP_BLOGS_SLUG, BP_REGISTER_SLUG, BP_ACTIVATION_SLUG ) );
    261261
    262     $illegal_names = array_merge( (array)$db_illegal_names, (array)$filtered_illegal_names );
     262    /* Safely merge our illegal names into existing site_option */
     263    $common_names           = array_intersect( (array)$db_illegal_names, (array)$filtered_illegal_names );
     264    $diff_names             = array_diff( (array)$db_illegal_names, (array)$filtered_illegal_names );
     265    $illegal_names          = array_merge( (array)$diff_names, (array)$common_names );
     266
    263267    update_site_option( 'illegal_names', $illegal_names );
    264268
    265269    if ( !validate_username( $user_name ) || in_array( $user_name, (array)$illegal_names ) || $user_name != $maybe[0] )
    266         $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) );
     270        $errors->add( 'user_name', __( 'Only lowercase letters and numbers allowed', 'buddypress' ) );
    267271
    268272    if( strlen( $user_name ) < 4 )
    269         $errors->add( 'user_name',  __( 'Username must be at least 4 characters', 'buddypress' ) );
     273        $errors->add( 'user_name',  __( 'Username must be at least 4 characters', 'buddypress' ) );
    270274
    271275    if ( strpos( ' ' . $user_name, '_' ) != false )
Note: See TracChangeset for help on using the changeset viewer.