If you make the other groups Private or Hidden, users can only join the one group you have left Public. You’ll need to provide more detail if you are looking for something different than that.
I need to create N public groups.
Users can join only into one public groups. If an users is joined into a group, can’t join into other group.
Thanks
I’m sorry, I don’t understand what you are asking.
I create some groups.
When users are registering, I have a form as http://social.keantex.com/wp/registrazione/
I need that users can join to only one groups.
thanks
You could use this plugin to create mandatory groups that users can’t leave.
https://wordpress.org/plugins/buddypress-mandatory-groups/
The Group management functionality in the dashboard could help you sort users into the appropriate group.
Something like this would allow you to have users select groups when they are registering
https://wordpress.org/plugins/buddypress-registration-groups-1/
Take a look at this file:
buddypress\bp-templates\bp-legacy\buddypress-functions.php
~Line 110 there are 2 add_action calls to create a join-group button – ‘bp_group_join_button’.
You need to write a function that checks if the user is a member of any group.
If they are, do 2 remove_action calls so that the button is not created.
Except, of course, for the group that they belong to, otherwise the ‘Leave Group’ button will not appear.