bp_admin_assign_member_type()
Assign members without a profile type to the default profile type (excludes admins).
Description
Return
(array)
Source
File: bp-core/admin/bp-core-admin-tools.php
function bp_admin_assign_member_type() { $users = get_users( [ 'fields' => [ 'ID' ] ] ); foreach ( $users as $user ) { $member_type = bp_get_member_type( $user->ID ); if ( false === $member_type ) { // Get the user object. $user1 = get_userdata( $user->ID ); if ( ! in_array( 'administrator', $user1->roles, true ) ) { $existing_selected = bp_member_type_default_on_registration(); // Assign the default member type to user. bp_set_member_type( $user->ID, '' ); bp_set_member_type( $user->ID, $existing_selected ); } } } // Description of this tool, displayed to the user. $statement = __( 'Assign users without a profile type to the default profile type records… %s', 'buddyboss' ); $result = __( 'Complete!', 'buddyboss' ); // All done! return array( 0, sprintf( $statement, $result ) ); }
Changelog
Version | Description |
---|---|
BuddyBoss 1.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.