bp_members_add_role_after_activation( int $user_id )
Add default WordPress role for new signups on the BP root blog.
Description
Parameters
- $user_id
-
(int) (Required) The user ID to add the default role for.
Source
File: bp-members/bp-members-functions.php
function bp_members_add_role_after_activation( $user_id ) { // Get default role to add. $role = bp_get_option( 'default_role' ); // Multisite. if ( is_multisite() && ! is_user_member_of_blog( $user_id, bp_get_root_blog_id() ) ) { add_user_to_blog( bp_get_root_blog_id(), $user_id, $role ); // Single-site. } elseif ( ! is_multisite() ) { $member = get_userdata( $user_id ); $member->set_role( $role ); } }
Changelog
Version | Description |
---|---|
BuddyPress 3.0.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.