Firstly is have set 3 members type using member_type()
function . then I set the roles
Using Henry’s solution
I.e
add_role(
'student',
__( 'Student' ),
array(
'read' => true, // true allows this capability
'edit_posts' => true,
'delete_posts' => false, // Use false to explicitly
)
);
Then by using this function I tie these roles to wo roles.
function youmin_set_role( $user_id, $member_type, $append ) {
$userdata = array( 'ID' => $user_id, 'role' => $member_type );
wp_update_user( $userdata );
}
add_action( 'bp_set_member_type', 'youmin_set_role', 10, 3 );
But still every user is able to create group since by default wp role ‘subscriber’ is loading and buddypress user role let’s the subscriber to create group.
So isn’t it possible to pass an array to above role function to restrict group creation ? Or any other code snippet ?
Take a look at https://buddypress.org/support/topic/how-to-bp_set_member_type/