Restricting users to join any one private group


I am running a private forum for educational purpose, it is exclusively for the students enrolled with us.

In the forum there are many private categories which are allowed to students based on their subject of enrollment. For example, students enrolled in maths get access to the maths category only, not science category. Currently we have private groups for each private category, and we approve membership requests manually to groups to grant them access to a primary category.

I would like to automate this. The student should be able join any one private group if they have been assigned a certain badge. I have already created the badge. How do I put restriction on the number of custom groups that the user can join?


You’ll need a plugin to do that.


Yes can you give some pointers on plugin development which I can pass to my developer.

I understand it requires development that’s why posted in dev category.


Are you aware of invitations to groups?

If you have one method to reach group of students besides of discourse, you could tell them an invitation link using this channel.

Do you meet students in real life?
Then you could present them an invitation via QR-Code.


Jay might the Automation plugin or Pavilion’s Wizard plugin maybe work for this?


I agree with @thoka, if you want to assign a badge manually in order to grant access to a group, then an invitation can be as quick.
If you need/want a badge associated with each group, then you could create new badges SQL query to give badges to users depending on the groups they belong to: Create Triggered Custom Badge Queries

With this combination, you’ll be able to put students in groups and have them have a badge, all of this without having to create a custom plugin.

As an alternative, as @Heliosurge suggested, you could maybe use the Automation official plugin to set users in a group depending on a custom field value. There’s a script for this:

I don’t know how it works but I believe it would require some custom code to make it work.


If you use any kind of student management system and use SSO elsewhere, then you can probably manage group membership in your SSO payload. No need for a plugin, or anything else.


Hey, I also wanted to implement the same. for eg- we have two custom badges and two private group i.e., badge A, badge B, group A and group B depending on the badge if user has assigned badge A then he should be able to join only group A not group B and vice versa too.
How can I implement this for my system too.
Kindly brief me the same.