Proper way to set digest and hide category from latest

AI-generated summary

The discussion revolves around setting digest and hiding categories from the latest page for multiple users. Ivan_Rapekas wants to apply the same category settings to 100 users, including mail list options and hiding certain categories from the latest page.

Ivan_Rapekas initially tried modifying the category_users table, but wasn’t sure if it was the correct approach. IAmGav suggested using the built-in settings, but Ivan_Rapekas needed a batch way to set this for multiple users.

Ivan_Rapekas eventually found a solution by:

  1. Setting the desired category settings in the UI.
  2. Identifying the category and user IDs in the category_users and users tables.
  3. Creating a script to insert the muted categories into the category_users table.
  4. Updating the notification levels for tracked and watched categories.

The solution successfully updated user settings, hiding muted categories from the main page and latest topics. Ivan_Rapekas asks if there’s a simpler way to bulk edit user settings concerning muted or watched categories.

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

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:

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.