bp_members_signup_with_subdirectory_blog( array $illegal_names = array() )
Make sure the username is not the blog slug in case of root profile & subdirectory blog.
Description
If BP_ENABLE_ROOT_PROFILES is defined & multisite config is set to subdirectories, then there is a chance site.url/username == site.url/blogslug. If so, user’s profile is not reachable, instead the blog is displayed. This filter makes sure the signup username is not the same than the blog slug for this particular config.
Parameters
- $illegal_names
-
(Optional) Array of illiegal names.
Default value: array()
Return
(array) $illegal_names
Source
File: bp-members/bp-members-filters.php
function bp_members_signup_with_subdirectory_blog( $illegal_names = array() ) { if ( ! bp_core_enable_root_profiles() ) { return $illegal_names; } if ( is_network_admin() && isset( $_POST['blog'] ) ) { $blog = $_POST['blog']; $domain = ''; if ( preg_match( '|^([a-zA-Z0-9-])$|', $blog['domain'] ) ) { $domain = strtolower( $blog['domain'] ); } if ( username_exists( $domain ) ) { $illegal_names[] = $domain; } } else { $illegal_names[] = buddypress()->signup->username; } return $illegal_names; }
Changelog
Version | Description |
---|---|
BuddyPress 2.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.