Hi @nickguidomedia
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.
question on the $usermeta , do you know how this returns? can i get the xprofile_get_field_data( “zipcode” ); in a similar fashion from the $usermeta?
Does var_dump( $usermeta );
tell you anything? I think it’ll probably be an array
of stuff like the user’s password, profile field IDs etc
ended up going about this completely different actually. was easy to just pass $user_id, $xprofile_data
to my function.
and call $zipcode = xprofile_get_field_data(7, $user_id);
from there i was easily able to do the rest.