Reply To: Check to see if group is full
My first thought was to get the member count of the relevant group during each user registration.
That can be done with groups_get_total_member_count( $group_id );.
You’d need to check this figure is less or equal to 150 and if it isn’t, you’d need to add the user to an over-spill group, creating a new one if necessary.
As you mentioned users are added to a group automatically during registration.
The bp_core_signup_user hook fires at the end of the registration process so could hook all your code for the above to that. That hook gives you access to $user_id, $user_login, $user_password, $user_email and $usermeta, so you should be able to get all the info you need from those. For example:
function my_func( $user_id, $user_login, $user_password, $user_email, $usermeta ) {
// Write your code here.
}
add_action( 'bp_core_signup_user', 'my_func', 10, 5 );
Hope this helps.