Proper way to set digest and hide category from latest

Hi,

as an admin of the forum, I want all users will be subscribed to certain categories with the mail list option enabled.

I tried to set categories in my profile (watched, tracked and muted) so that to find these settings in the database. I would like to apply the same settings to other users, seems it is category_users

изображение

Am I right, that I can make some inserts to achive this?

Previously I tried to set some categories as ‘mail listed’ to be sure that digest would contain only those categories, but I wasn’t right - this setting doesn’t tune the digest contents.

Maybe the logic is different? The aim is:

  • to force new users to receive a digest from certain categories (okay, let them to modify by themselves later)
  • do not show some categories in their ‘latest’ page

I found a topic Viewing a list of users who are watching a category near to my case. But I was not sure to bump it after 5 years.

why dont you use these settings

image

1 Like

I’m not sure this can help. I’m looking for a batch way to set this for 100 other users.

If you select it, a box pops up asking if you want to change it for everyone, or just going forward. :+1:

1 Like

I’d like to share my solution.

I clicked necessary settings in UI (mute and track some categories) as Gavin mentioned:

Then I connected to the DB to determine id’s of categories and users. Tables: category_users and users.

I filtered settings for myself (for user_id=5) as shown in the picture below:
изображение

Next, I want to apply the same settings for two other users with id=33 and 34. Obviously I need to add proper lines into the table category_users.

Example:

  • There are 6 categories: id=1, 2, 15, 17, 19 and 24.
  • Muted categories 15 and 17
  • Watching the first post in categories 1, 2 and 24
  • Tracking one category 19.

First of all I created a script that insertes all of the selected categories to muted section (notification_level=0):

INSERT INTO 
	"category_users" 
	("category_id", "user_id", "notification_level", "last_seen_at") 
VALUES
(24, 34, 0, NULL),
(2,  34, 0, NULL),
(1,  34, 0, NULL),
(19, 34, 0, NULL),
(15, 34, 0, NULL),
(17, 34, 0, NULL),

(24, 33, 0, NULL),
(2,  33, 0, NULL),
(1,  33, 0, NULL),
(19, 33, 0, NULL),
(15, 33, 0, NULL),
(17, 33, 0, NULL);

You may add up to 1000 lines at once.

After that I updated the raws for Tracked and Watched 1st post categories:

--watch 1st post
UPDATE "public"."category_users" SET "notification_level"='4' WHERE  "category_id" in (1,2,24);
--track
UPDATE "public"."category_users" SET "notification_level"='2' WHERE  "category_id"=19;

After that user settings are updated. Muted categories are hidden from main page and latest topics.

изображение

Let me know if there is any other simple way to bulk edit users settings concerning muted or watched categories.

1 Like