# Restricting users to join any one private group

**URL:** https://meta.discourse.org/t/restricting-users-to-join-any-one-private-group/257859
**Category:** Development
**Created:** [March 12, 2023, 1:41pm UTC](https://meta.discourse.org/t/restricting-users-to-join-any-one-private-group/257859 "2023-03-12T13:41:32Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [March 13, 2023, 9:08pm UTC](https://meta.discourse.org/t/restricting-users-to-join-any-one-private-group/257859/6 "2023-03-13T21:08:22Z")

</div>

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: [Creating triggered custom badge queries](https://meta.discourse.org/t/create-triggered-custom-badge-queries/19336)

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](https://meta.discourse.org/t/discourse-automation/195773) official plugin to set users in a group depending on a custom field value. There’s a script for this:

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/8/e/d8e3ecd72c5cb6f404ec0b5f07e6dd69822e0bc1.png)  
I don’t know how it works but I believe it would require some custom code to make it work.

---

_[View the full topic](https://meta.discourse.org/t/restricting-users-to-join-any-one-private-group/257859)._
