# Force category watching based on group membership only once

**URL:** https://meta.discourse.org/t/force-category-watching-based-on-group-membership-only-once/102254
**Category:** Feature
**Created:** [November 17, 2018, 11:17pm UTC](https://meta.discourse.org/t/force-category-watching-based-on-group-membership-only-once/102254 "2018-11-17T23:17:36Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [November 17, 2018, 11:17pm UTC](https://meta.discourse.org/t/force-category-watching-based-on-group-membership-only-once/102254/1 "2018-11-17T23:17:36Z")

</div>

Continuing the discussion from [Ability to force subscription to a category](https://meta.discourse.org/t/ability-to-force-subscription-to-a-category/66357):

There is a solution for making all new users watch a category by default (and users can change that as they like).

There is also [a solution](https://meta.discourse.org/t/ability-to-force-subscription-to-a-category/66357) to force users to watch a category based on their group membership (and users are _not_ able to permanently unwatch that category as long as they are a member of the group that triggered the watching).

What I am missing is the ability to make users watch a category based on group membership once (i.e. when they join the group) but not enforce if they choose to untwatch. I suppose this would be a matter of extending this plugin to make sure that every user is forced into watching any particular category only once:

[https://github.com/amical/discourse-watch-category](https://github.com/amical/discourse-watch-category)

Or is there an easier way?

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [November 18, 2018, 3:26pm UTC](https://meta.discourse.org/t/force-category-watching-based-on-group-membership-only-once/102254/2 "2018-11-18T15:26:57Z")

</div>

Another useful modification of this plugin would be to apply it only to each user’s primary group. How would I do that? @techAPJ @alehandrof

Oh, and here is another idea that does not require any code changes, but would it work? What if I include various private categories in `default categories watching first post`, will that entail that whenever a user first acquires access to that category (by joining a specific group) s/he will be made to watch that category?

---

<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: [November 19, 2018, 5:59am UTC](https://meta.discourse.org/t/force-category-watching-based-on-group-membership-only-once/102254/3 "2018-11-19T05:59:28Z")

</div>

This is going to require a plugin of sorts.

I talked about workflows here interestingly enough:

> [@Apply a Group to All New Users](https://meta.discourse.org/t/apply-a-group-to-all-new-users/102054/6):
>
> That means we need to define a rather complex UX for workflows inside the admin section. Technically you can achieve this today with a plugin and we have some prior art with the way we define parts of workflows with webhooks. I do see us having a “drag and drop” workflow kind of thing in the next say 5-10 years, but it is not in the immediate or medium plan. When I say “workflow” I mean using admin interfaces in some theoretical world you could define. When a user is created Then apply grou…

You are going to need a plugin for now.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [November 19, 2018, 12:13pm UTC](https://meta.discourse.org/t/force-category-watching-based-on-group-membership-only-once/102254/4 "2018-11-19T12:13:25Z")

</div>

> [@sam](#):
>
> You are going to need a plugin for now

I suspected that. And luckily, there is already one that makes people watch based on group membership. So what would it take to modify that so that when a users unwatch a force-watched category they will not be re-forced to watch it?

I suppose the plugin would have to maintain a table that keeps track of which categories a user has ever been watching and check against that table before making any user watch a particular category (if that user-category combination is in the table, don’t force-watch). Right?

---

<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: [November 20, 2018, 4:48am UTC](https://meta.discourse.org/t/force-category-watching-based-on-group-membership-only-once/102254/5 "2018-11-20T04:48:13Z")

</div>

> [@tophee](#):
>
> Right?

I think we have an event that is fired when a user is added to a group so you would subscribe to that and just do the once off adding there. No need then to worry about tracking anything fancy to catch the 0.01% edge cases.
