Changeset 3446 for branches/1.2/bp-core/bp-core-signup.php
- Timestamp:
- 11/19/2010 04:44:13 PM (16 years ago)
- File:
-
- 1 edited
-
branches/1.2/bp-core/bp-core-signup.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.2/bp-core/bp-core-signup.php
r3441 r3446 255 255 * true or false on success or failure. 256 256 */ 257 258 /**259 * bp_core_flush_illegal_names()260 *261 * Flush illegal names by getting and setting 'illegal_names' site option262 */263 function bp_core_flush_illegal_names() {264 $illegal_names = get_site_option( 'illegal_names' );265 update_site_option( 'illegal_names', $illegal_names );266 }267 268 /**269 * bp_core_illegal_names()270 *271 * Filter the illegal_names site option and make sure it includes a few272 * specific BuddyPress and Multi-site slugs273 *274 * @param array|string $value Illegal names from field275 * @param array|string $oldvalue The value as it is currently276 * @return array Merged and unique array of illegal names277 */278 function bp_core_illegal_names( $value = '', $oldvalue = '' ) {279 280 // Make sure $value is array281 if ( empty( $value ) )282 $db_illegal_names = array();283 if ( is_array( $value ) )284 $db_illegal_names = $value;285 elseif ( is_string( $value ) )286 $db_illegal_names = implode( ' ', $names );287 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 324 // Add our slugs to the array and allow them to be filtered325 $filtered_illegal_names = apply_filters( 'bp_core_illegal_usernames', array_merge( array( 'www', 'web', 'root', 'admin', 'main', 'invite', 'administrator' ), $bp_component_slugs ) );326 327 // Merge the arrays together328 $merged_names = array_merge( (array)$filtered_illegal_names, (array)$db_illegal_names );329 330 // Remove duplicates331 $illegal_names = array_unique( (array)$merged_names );332 333 return apply_filters( 'bp_core_illegal_names', $illegal_names );334 }335 add_filter( 'pre_update_site_option_illegal_names', 'bp_core_illegal_names', 10, 2 );336 257 337 258 /**
Note: See TracChangeset
for help on using the changeset viewer.