# What if badges could optionally synchronize group membership?

**URL:** https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232
**Category:** Feature
**Tags:** badges, groups, completed
**Created:** [13 juli 2018 om 04:58 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232 "2018-07-13T04:58:13Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [13 juli 2018 om 04:58 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/1 "2018-07-13T04:58:13Z")

</div>

I was looking at this topic today:

> [@Feature request: Category unlocking based on data](https://meta.discourse.org/t/feature-request-category-unlocking-based-on-data/72305):
>
> We’re trying to create a drip-campaign style experience, where a new user sees only one category when they join and then every few days another category is unlocked. We currently use category security to hide future lessons from students by setting those categories to admin-only access, and then, as the days pass, manually changing the security setting to allow everyone access on the day of the lesson/discussion. But this only works for everyone in our Discourse at the same time. One thing tha…

Thinking through the problem one area Discourse is a bit weak is around defining “dynamic” groups of users.

> Give me a group of users that signed up more than 1 month ago

> Give me a group of users that posted at least 10 times

And so on.

Badges on the other hand have very rich support for this “dynamic” nature once the fancy SQL is enabled.

Having an “extra” tick box on badges to bridge a badge to a group would add a lot of power. We have no way of assigning permissions to badge holders as it stands cause there is no backing group. Only the trust level badges have this special behavior (which we could port to this new system)

So my proposal here is for:

```plaintext
[] mirror badge members in a group

```

Once this is ticked on a specific badge a “group” would be either automatically created or looked up based on name and the members of the group would be kept in sync as the badge membership changes.

Thoughts?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [13 juli 2018 om 05:11 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/2 "2018-07-13T05:11:46Z")

</div>

Because the group membership management UI is so rich these days, changes should at least attempt to flow in the opposite direction as well (e.g. approving a Request to Join turns into a badge grant from the group manager; which wouldn’t normally happen as they aren’t staff).

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [13 juli 2018 om 05:46 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/3 "2018-07-13T05:46:52Z")

</div>

I feel like this has massive overlap with trust levels; it’s building a parallel system for.. well, I’m not sure why. In the quote you posted, that is _literally_ the reason we have trust levels in the first place. So tying content unlock to

- trust level 1 (a tiny bit of reading)
- trust level 2 (a fair bit more reading)

should cover this scenario.

There are many many things I’d rather we work on than this.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [13 juli 2018 om 05:55 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/4 "2018-07-13T05:55:25Z")

</div>

> [@codinghorror](#):
>
> There are many many things I’d rather we work on than this.

I definitely do not see this as an urgent change, we lock out badge sql anyway out-of-the-box. However I do see this as something I would like to get to eventually.

It is a simple generalization of the “automatic group” system that now exists.

This does simplify workflows as well, you can grant a badge to a user and then you do not need to go to the group and also grant membership. For example: “Customer champion” badge that grants access to “champions” group and “champion discussion” category on the site. Having the bridge also means you only need to remove membership in 1 spot to have both badge and group change.

Nothing urgent to change here, its just that there are tons of parallels between groups and badges so having a bridge helps get automatic feature parity on both sides.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [16 juli 2018 om 17:25 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/5 "2018-07-16T17:25:43Z")

</div>

Prior requests:

> [@Group Assignment SQL Query](https://meta.discourse.org/t/group-assignment-sql-query/25610):
>
> Before I get to my feature request, I would like to take the time to thank the Discourse team for their work. Discourse is an epic piece of software, and so far everyone I have introduced it to has nothing but high praise for it. Feature Would it be possible to extend the Badge Query options to groups. Currently groups can either be assigned by email domain or manually. Adding SQL queries would extend that to support anything an admin can imagine. Use Case I currently use SSO to integrate dis…

> [@Feature request: Category unlocking based on data](https://meta.discourse.org/t/feature-request-category-unlocking-based-on-data/72305):
>
> We’re trying to create a drip-campaign style experience, where a new user sees only one category when they join and then every few days another category is unlocked. We currently use category security to hide future lessons from students by setting those categories to admin-only access, and then, as the days pass, manually changing the security setting to allow everyone access on the day of the lesson/discussion. But this only works for everyone in our Discourse at the same time. One thing tha…

I know that just tying this up to the a badge re-uses a bunch of code, and simplifies a lot, but ideally this would be an option in the Groups UI, to have an option query that returns the `user_id` of members.

When you tie this to SSO and custom user fields, you get a very powerful system, where you can manage groups using queries on those custom fields + all the info Discourse already have.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [16 mei 2019 om 12:22 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/6 "2019-05-16T12:22:44Z")

</div>

I have a client who wants just this. He wants to encourage people to fill in custom user fields after sign up and give them flair if they do it.

It’s easy enough to enable badge sql to find them a badge but we need to assign them to a group for flair.

How hard is a plugin to assign a user to a group of they have earned a badge?

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [9 november 2019 om 07:33 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/7 "2019-11-09T07:33:29Z")

</div>

Did you manage to solve this, @pfaffman? I’m exploring a similar scenario myself.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [9 november 2019 om 12:50 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/8 "2019-11-09T12:50:48Z")

</div>

I did not, but I think that I now know how to develop such a plugin. Ping me with your budget and I’ll see what I can do for you.

---

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [9 november 2019 om 12:52 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/9 "2019-11-09T12:52:26Z")

</div>

I have no budget for this one, I think it can also (less elegantly) be achieved with an Integromat or Zapier script.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [9 november 2019 om 13:03 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/10 "2019-11-09T13:03:35Z")

</div>

Well, maybe I could get you enough coffee code that you could tweak it yourself. I’m pretty busy right now, but I’ll see what I can do.

EDIT: Well, it’s not going to work how I thought it would. It’ll take me some time to figure out how to go about doing it.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [4 april 2023 om 09:57 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/11 "2023-04-04T09:57:37Z")

</div>

I am very interested in this topic. I would like to ask if anyone has developed a corresponding plugin? If not, I’ll develop one

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [4 april 2023 om 10:37 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/12 "2023-04-04T10:37:27Z")

</div>

Easiest way to land this would be by using Discourse automation, a special “synchronize badge to group” custom script, should be reasonably easy to build.

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [4 april 2023 om 10:40 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/13 "2023-04-04T10:40:10Z")

</div>

Or add users to groups using reports from Discourse [Data Explorer](https://meta.discourse.org/t/32566?silent=true)?  
It would be awesome if this could be done.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [11 oktober 2023 om 10:46 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/14 "2023-10-11T10:46:03Z")

</div>

This is now possible using the [Automation](https://meta.discourse.org/t/discourse-automation/195773) plugin: 🎉

> [@User Group Membership Management Through Badges](https://meta.discourse.org/t/user-group-membership-management-through-badges/281836):
>
> We recently added the update\_user\_group\_membership\_via\_badge automation. This were long standing requests at: (including one from yours truly) [Automatic membership of badge earners in the group](https://meta.discourse.org/t/automatic-membership-of-badge-earners-in-the-group/172315)[What if badges could optionally synchronize group membership?](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232)[Automatically add/remove users to/from a group based on badge id?](https://meta.discourse.org/t/automatically-add-remove-users-to-from-a-group-based-on-badge-id/31431)[Badge granting triggers group membership](https://meta.discourse.org/t/badge-granting-triggers-group-membership/143242)What does it do? This feature allows you to automate user group membership based on their badges. It provides you with the ability to…

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [11 oktober 2023 om 10:46 UTC](https://meta.discourse.org/t/what-if-badges-could-optionally-synchronize-group-membership/92232/15 "2023-10-11T10:46:06Z")

</div>


