Change default category watch state for administrator
-
-
@baris Shouldn't that be up to an administrator to determine whether this is acceptable for their forum or not? We're trying to get a society to use nodeBB but if we can't even get notifications to users in an "Announcements" category without having to tell them they have to click buttons to turn the feature on, it's just another barrier to getting people moved to the forum and having them return when there's activity.
Is there another path for a very small group / community that gets notifications/emails to people by default when there's activity? If not, why would we migrate out of an email distribution then?
-
If you really want every user to watch a category I would suggest using a plugin to automatically watch the category on user creation. It can be done with the
action:user.create
hook.// in plugin.json "hooks" : { "action:user.create": "onUserCreate" } // in library.js of your plugin const categories = require.main.require('./src/categories'); plugin.onUserCreate = async function ({ user }) { const announcementCategory = 1; await user.setCategoryWatchState(user.uid, [announcementCategory], categories.watchStates.watching); };
-
It is not an entire plugin but it's the only code you need in a plugin to achieve what you want. A plugin has some boilerpate code. You can see a full starter plugin at https://github.com/NodeBB/nodebb-plugin-quickstart. The plugin docs also go over the details https://docs.nodebb.org/development/quickstart/