# Make members of a group watch a category by default

**URL:** <https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127>\
**Category:** Feature\
**Tags:** completed\
**Created:** [2014年十一月13日 08:27 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127 "2014-11-13T08:27:01Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)\
**Post date:** [2017年五月11日 17:01 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/65 "2017-05-11T17:01:05Z")

</div>

Hi Christoph. Sorry for not answering earlier. Good to know you figured it out. Admittedly, it’s not a very intuitive plugin. An admin UI would go along way towards making it more usable.

---

<div class="post-metadata">

**Author:** ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)\
**Post date:** [2017年十月31日 15:30 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/66 "2017-10-31T15:30:47Z")

</div>

This can probably be closed now, although…

One feature I’m missing is the ability to change these settings via a category’s own settings. I went looking for this setting when a customer requested it, and the first place I looked was the settings screen of a specific category.

#pr-welcome?

---

<div class="post-metadata">

**Author:** ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)\
**Post date:** [2017年十一月2日 08:52 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/67 "2017-11-02T08:52:11Z")

</div>

Has this been added as core functionality?

---

<div class="post-metadata">

**Author:** ![erlend\_sh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/erlend_sh/32/119475_2.png) [@erlend\_sh](https://meta.discourse.org/u/erlend_sh)\
**Post date:** [2017年十一月2日 10:39 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/68 "2017-11-02T10:39:18Z")

</div>

If you’re referring to the ‘default categories watching’ setting and it’s cousins, then yes, it’s in core.

---

<div class="post-metadata">

**Author:** ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)\
**Post date:** [2017年十一月2日 15:56 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/69 "2017-11-02T15:56:54Z")

</div>

I’m not sure what the cousins you’re referring to are, but the `default categories watching` setting doesn’t accomplish the OP’s goal:

> [@Skud](#):
>
> Under the category’s security settings, when I say “staff can create/reply/see” I’d love it if there were a way to say “and are watching this category by default”. Then when I add a new member to the staff group, they’d get set up to automatically watch the category. They could override if if they wanted to, but they’d start out by getting all the notifications.

I don’t just mean there’s no UI like that. AFAIK, the only way to get a specific group (not all users) to “watch” (or “watch first post” or whatever) a specific category – and to have that happen after the user has been created – is by using a plugin, [such as the one I use](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/43).

I’d be happy to ditch this workaround, but I don’t see this functionality in core. Or have I missed something in a recent update?

---

<div class="post-metadata">

**Author:** ![David\_Baker1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david_baker1/32/67655_2.png) [@David\_Baker1](https://meta.discourse.org/u/David_Baker1)\
**Post date:** [2018年二月10日 12:06 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/70 "2018-02-10T12:06:53Z")

</div>

I don’t see in this thread whether staff have answered the question if they agree this feature should be in core. Knowing if it’s in the pipeline or not would help.

---

<div class="post-metadata">

**Author:** ![LeoMcA](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leomca/32/87233_2.png) [@LeoMcA](https://meta.discourse.org/u/LeoMcA)\
**Post date:** [2018年二月12日 12:07 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/71 "2018-02-12T12:07:17Z")

</div>

I created an RFC for the implementation side of this a while back (I’m sure I linked to it _somewhere_ in this thread):

> [@Spec: set group default category notification settings](https://meta.discourse.org/t/spec-set-group-default-category-notification-settings/55148):
>
> Continuing the discussion from [Make members of a group watch a category by default](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127): (splitting out from this topic, because it’s quite old, there’s a bit of noise, and I really want this.) We have the need to set the default notification settings of groups on our Discourse instance within Mozilla, and I’d like to build the feature upstream because it seems like its something a number of users could benefit from. I see this being implemented in much the same way that default category notificat…

But it looks like the consensus is for implementing this as a plugin. That’s something I plan to do at some point, but I can’t say when.

---

<div class="post-metadata">

**Author:** ![mboes](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mboes/32/109454_2.png) [@mboes](https://meta.discourse.org/u/mboes)\
**Post date:** [2018年八月22日 09:05 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/72 "2018-08-22T09:05:37Z")

</div>

> But it looks like the consensus is for implementing this as a plugin. That’s something I plan to do at some point, but I can’t say when.

@LeoMcA is this something you got around to doing in the end?

---

<div class="post-metadata">

**Author:** ![LeoMcA](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leomca/32/87233_2.png) [@LeoMcA](https://meta.discourse.org/u/LeoMcA)\
**Post date:** [2018年八月22日 12:04 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/73 "2018-08-22T12:04:55Z")

</div>

Not yet, I’ll post in that other thread when I do 🙂

---

<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:** [2018年八月22日 15:39 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/74 "2018-08-22T15:39:11Z")

</div>

There are a couple plugins that do this that require a bit of customization to work. One is linked above. If it won’t work for you and you have a budget, feel free to contact me.

---

<div class="post-metadata">

**Author:** ![kimardenmiller](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kimardenmiller/32/119631_2.png) [@kimardenmiller](https://meta.discourse.org/u/kimardenmiller)\
**Post date:** [2018年八月27日 22:48 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/75 "2018-08-27T22:48:44Z")

</div>

> [@pfaffman](#):
>
> There are a couple plugins that do this that require a bit of customization to work

@pfaffman, interested in what plugin you might recommend. Are you [referring to this one](https://github.com/discourse/discourse-watch-category-mcneel)?

---

<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:** [2018年八月27日 23:14 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/76 "2018-08-27T23:14:16Z")

</div>

Yes. That’s one that I’ve modified. I modified it find all groups matching a pattern, and then find categories with similar names and force watching for those.

---

<div class="post-metadata">

**Author:** ![kimardenmiller](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kimardenmiller/32/119631_2.png) [@kimardenmiller](https://meta.discourse.org/u/kimardenmiller)\
**Post date:** [2018年八月27日 23:43 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/77 "2018-08-27T23:43:12Z")

</div>

Very cool. If all we want to do is force watch 2-3 Categories for 2-3 Groups, the plug in will work out of the box?

Is there any documentation on it, or is it self-explanatory once installed?

---

<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:** [2018年八月28日 00:09 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/78 "2018-08-28T00:09:42Z")

</div>

No, it won’t work out of the box. You need to fork it on Github and modify the `plugin.rb` file so that it matches your groups and categories. Then you install your modified version.

---

<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:** [2018年八月28日 13:15 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/79 "2018-08-28T13:15:24Z")

</div>

> [@kimardenmiller](#):
>
> Is there any documentation on it, or is it self-explanatory once installed?

Nope. If you know any programming, you might be able to make sense of the code. If not, and you have a budget, you can post in #Marketplace, or contact me directly. My contact info is in my profile.

---

<div class="post-metadata">

**Author:** ![kimardenmiller](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kimardenmiller/32/119631_2.png) [@kimardenmiller](https://meta.discourse.org/u/kimardenmiller)\
**Post date:** [2018年八月28日 18:18 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/80 "2018-08-28T18:18:12Z")

</div>

> [@pfaffman](#):
>
> If you know any programming, you might be able to make sense of the code. If not, and you have a budget, you can post in #Marketplace, or contact me directly.

Ok, Jay. We’ve certainly valued your work in the past, so will ping you if we need further assist!

> [@tophee](#):
>
> No, it won’t work out of the box. You need to fork it on Github and modify the `plugin.rb` file so that it matches your groups and categories. Then you install your modified version.

Thanks, Christoph. We’ll have a look!

---

<div class="post-metadata">

**Author:** ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)\
**Post date:** [2018年八月29日 05:43 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/81 "2018-08-29T05:43:25Z")

</div>

@kimardenmiller I use this plugin, which I developed from the ones mentioned here:  
[https://github.com/amical/discourse-watch-category](https://github.com/amical/discourse-watch-category)

If you can fork that plugin on GitHub, I can help you customize it. 👌

---

<div class="post-metadata">

**Author:** ![kimardenmiller](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kimardenmiller/32/119631_2.png) [@kimardenmiller](https://meta.discourse.org/u/kimardenmiller)\
**Post date:** [2018年八月29日 15:42 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/82 "2018-08-29T15:42:28Z")

</div>

Nice Alex. Looks as if you have nicely parameterized it with the `groups_cats` dictionary.

Just edit those for _Watching_ vs. _Watching First Post_, then just edit the frequency at the end?

Anything else to know?

---

<div class="post-metadata">

**Author:** ![alehandrof](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alehandrof/32/119526_2.png) [@alehandrof](https://meta.discourse.org/u/alehandrof)\
**Post date:** [2018年八月29日 16:03 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/83 "2018-08-29T16:03:49Z")

</div>

Nope, you got it! 👍

Holler if you run into trouble.

---

<div class="post-metadata">

**Author:** ![xav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xav/32/153918_2.png) [@xav](https://meta.discourse.org/u/xav)\
**Post date:** [2019年八月30日 16:06 UTC](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127/84 "2019-08-30T16:06:54Z")

</div>

我确实需要这个功能，但只需要一次性执行。我参考了这个插件的代码，在 Rails 控制台中运行了几行命令：

进入 Discourse 文件夹后执行：

```
./launcher enter app
root@application-app:/var/www/discourse# rails c
[1] pry(main)>

```

进入 Rails 控制台后：

```
## 根据需要自定义以下内容
g = Group.find_by_name('your_group')
c_id = Category.find_by_slug('you_category_slug').id
pref = :watching_first_post

g.users.each do | user |
   existing = CategoryUser.lookup(user, pref).pluck(:category_id)
   CategoryUser.set_notification_level_for_category (user, CategoryUser.notification_levels[pref], c_id) unless existing.include?(c_id)
end

```

希望这对大家有帮助。

[上一頁](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127.md?page=3)

[下一頁](https://meta.discourse.org/t/make-members-of-a-group-watch-a-category-by-default/22127.md?page=5)
