Skip to:
Content

BuddyPress.org

Changeset 3441


Ignore:
Timestamp:
11/18/2010 07:43:08 PM (16 years ago)
Author:
djpaul
Message:

Make sure core components' names get correctly added to the list of Banned Names in multisite.

Location:
branches/1.2
Files:
2 edited

Legend:

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

    r3392 r3441  
    16851685 *
    16861686 * For example, it would stop someone creating a blog with the slug "groups".
    1687  *
    1688  * @package BuddyPress Core
    1689  * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
    16901687 */
    16911688function bp_core_add_illegal_names() {
    1692     global $bp;
    1693 
    1694     $current = maybe_unserialize( get_site_option( 'illegal_names' ) );
    1695     $bp_illegal_names = $bp->root_components;
    1696 
    1697     if ( is_array( $current ) ) {
    1698         foreach( (array)$bp_illegal_names as $bp_illegal_name ) {
    1699             if ( !in_array( $bp_illegal_name, $current ) )
    1700                 $current[] = $bp_illegal_name;
    1701         }
    1702         $new = $current;
    1703     } else {
    1704         $bp_illegal_names[] = $current;
    1705         $new = $bp_illegal_names;
    1706     }
    1707 
    1708     update_site_option( 'illegal_names', $new );
     1689    update_site_option( 'illegal_names', get_site_option( 'illegal_names' ), array() );
    17091690}
    17101691
  • branches/1.2/bp-core/bp-core-signup.php

    r3321 r3441  
    286286        $db_illegal_names = implode( ' ', $names );
    287287
     288    // Add the core components' slugs to the banned list even if their components aren't active.
     289    $bp_component_slugs = array( 'groups', 'members', 'forums', 'blogs', 'activity', 'profile', 'friends', 'search', 'settings', 'register', 'activate' );
     290
     291    if ( defined( 'BP_GROUPS_SLUG' ) )
     292        $bp_component_slugs[] = BP_GROUPS_SLUG;
     293
     294    if ( defined( 'BP_MEMBERS_SLUG' ) )
     295        $bp_component_slugs[] = BP_MEMBERS_SLUG;
     296
     297    if ( defined( 'BP_FORUMS_SLUG' ) )
     298        $bp_component_slugs[] = BP_FORUMS_SLUG;
     299
     300    if ( defined( 'BP_BLOGS_SLUG' ) )
     301        $bp_component_slugs[] = BP_BLOGS_SLUG;
     302
     303    if ( defined( 'BP_ACTIVITY_SLUG' ) )
     304        $bp_component_slugs[] = BP_ACTIVITY_SLUG;
     305
     306    if ( defined( 'BP_XPROFILE_SLUG' ) )
     307        $bp_component_slugs[] = BP_XPROFILE_SLUG;
     308
     309    if ( defined( 'BP_FRIENDS_SLUG' ) )
     310        $bp_component_slugs[] = BP_FRIENDS_SLUG;
     311
     312    if ( defined( 'BP_SEARCH_SLUG' ) )
     313        $bp_component_slugs[] = BP_SEARCH_SLUG;
     314
     315    if ( defined( 'BP_SETTINGS_SLUG' ) )
     316        $bp_component_slugs[] = BP_SETTINGS_SLUG;
     317
     318    if ( defined( 'BP_REGISTER_SLUG' ) )
     319        $bp_component_slugs[] = BP_REGISTER_SLUG;
     320
     321    if ( defined( 'BP_ACTIVATION_SLUG' ) )
     322        $bp_component_slugs[] = BP_ACTIVATION_SLUG;
     323   
    288324    // Add our slugs to the array and allow them to be filtered
    289     $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_ACTIVITY_SLUG, BP_XPROFILE_SLUG, BP_FRIENDS_SLUG, BP_SEARCH_SLUG, BP_SETTINGS_SLUG, BP_REGISTER_SLUG, BP_ACTIVATION_SLUG ) );
     325    $filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array_merge( array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' ), $bp_component_slugs ) );
    290326
    291327    // Merge the arrays together
Note: See TracChangeset for help on using the changeset viewer.