In the Support category, user SaintSal asked if there is a way for users to self-sign up for private groups via a special link, specifically to grant access to conference attendees. mikechristopher responded that this feature does not exist yet but has been requested as an enhancement Group-related enhancements.
When SaintSal inquired about achieving this via the API, Tom_Newsom confirmed it is possible by using the admin API to add or remove users from groups using curl commands with specific JSON endpoints. The discussion also touched on other potential methods, such as adding users during the SSO process dennyv and codinghorror noting that self-joining a group is a logical feature that has been available on the group page since Discourse 1.7 codinghorror.
I have a bunch of private categories, each of which is seen only by members of a specific group for that category. I’d like a way for them to sign themselves up to those groups.
For example, when we run a conference, we want attendees of that event to receive access to a special category for that conference so they can exchange ideas privately.
Is there a way to give members of this group a special link to sign up or add themselves to their group? Not all of these groups have a common email domain. I’d like to give them, forum.com/signup/funevent/ and then when they’re signed up, they’re automatically assigned to that group so they have access.
/admin/groups.json will tell you the [group_id] of every group
To add a member to a group curl -X PUT -d usernames=username -d api_key=ApiKeyGoesHere -d api_username=ApiUsernameGoesHere https://yoursite.tld/admin/groups/[group_id]/members.json?
To delete a member from a group curl -X DELETE -d username=username -d api_key=ApiKeyGoesHere -d api_username=ApiUsernameGoesHere https://yoursite.tld/admin/groups/[group_id]/members.json?
Note that the PUT command accepts a comma separated list, but DELETE is one username at a time