Set default sidebar categories for all users

:bookmark: This guide explains how to set default sidebar categories and reapply them to existing users.

:person_raising_hand: Required user level: Administrator

Use default navigation menu categories to choose the default sidebar categories. Applying a change to existing users updates only the categories you add or remove—it doesn’t replace their entire list or prevent later customization.

Set the default categories

  1. Go to “Admin” → “All site settings”.
  2. Search for default navigation menu categories.
  3. Open the selector and choose the categories. Click “×” beside a category to remove it.
  4. Click “✓” to save.

  1. If prompted to apply the change historically, choose:
    • “Yes” to update existing users as well as the default for people who join afterward.
    • “No, only apply change going forward” to change the default without updating existing users’ sidebars.

The prompt may not appear if no existing users are affected. Updates to existing users run in the background, so they may not appear immediately.

Reapply defaults that users have removed

Saving an unchanged list won’t restore categories a user removed. To reapply them:

  1. Note the categories you want to display.
  2. Clear the setting and save. Choose “Yes” to apply the removal to existing users when prompted.
  3. Add the categories you want and save again. Choose “Yes” to apply the additions when prompted.
  4. Allow the background updates to finish, then refresh and check the sidebar.

Use two separate saves. Removing and re-adding the same category before saving produces no change to apply. There’s no fixed waiting period; processing time depends on the site’s background jobs.

Understand what changes

When you apply a change to existing users:

Change to the setting Effect on their sidebar category lists
Add a category Adds it if it isn’t already present.
Remove a category Removes it, even if the user selected it themselves.
Leave a category unchanged Doesn’t restore it if the user removed it.
Leave a personally added category outside the setting Doesn’t remove it.

For example, clearing and re-adding the default “General” category won’t remove a personally added “Support” category that was never included in the setting. Waiting longer won’t change that result.

This procedure restores defaults, not identical sidebars. A complete reset would also have to remove unwanted personal selections. The broader add-all-then-remove approach discussed in the replies isn’t covered here because its reported failure hasn’t been resolved.

Category permissions still apply: selecting a private category doesn’t grant access or make it visible to users who can’t access it.

Additional resources

5 Likes

What’s the difference between removing the previous default and adding it in one step, or doing it in two steps with a pause in between?

I briefly thought this process would reset all personal customization. But based on my tests, that’s not the case. If a category wasn’t previously in the sidebar default setting and a user added it themselves, it won’t be removed just because the setting is cleared. Only what was previously configured in the setting is removed.

So, to make the sidebar the same for everyone, you would need to:

  • add all categories to the setting (and preferably not override this for everyone)
  • then remove all categories from the setting and override this for everyone
  • (wait a few minutes?)
  • add new categories and override this for everyone

Steps 2 and 4 need to be separated here because step one wasn’t applied for everyone. We could apply step one to everyone, so everyone has all categories in their sidebar, and after a few minutes, we remove all categories we don’t want in their sidebar, but that could result in a worse experience for a few minutes.

Are my tests, which show that the setting to clear manually added categories is not removed, incorrect? Is there another reason for the separation of the steps? I’d like to know so I can decide what information I might want to add to Configuring the default sidebar for your users.

3 Likes

@Moin
The way backfilling works here is a bit different than what one would expect. We don’t simply reset all the users’ sidebar categories when the default navigation menu categories setting is updated. Here’s what we do:

  • If the admin adds a few categories to the setting, only those newly added ones are added to all the users’ sidebars who didn’t have those set already.
  • If you remove a few categories from the setting, those are removed from all the users’ sidebars.

So the backfill doesn’t force the setting’s state on all the users, but it does a delta of existing values in the setting to those added or removed newly.

The key reason this is done is to preserve individual user’s preferences.

This is the PR this behavior was introduced in:
http://github.com/discourse/discourse/pull/18620

We recognized two ways of achieving the same categories on all the users:

  1. Add all, apply historically, remove some, apply historically.
  2. Remove all, apply historically, add some, apply historically.

In a recent attempt to do this for a big site, 1 didn’t work properly and 2 did. Hence I documented 2.

If you have time, do try out both the ways with a bunch of users to see if this works. If it helps, I can write an SQL query to confirm if the updating worked as expected. Do let me know what you think.

1 Like

I tried the steps you described in the first post again. And I still notice the same problem: The category the user added to their sidebar is not removed, so the result is not that all users have the same categories in their sidebar.

Detailed repro steps
  1. I created a brand new forum
  2. I created 5 categories (category1, category2, category3, category4, category5)
  3. I added category4 to my sidebar using the “edit sidebar categories” option

  4. The category was added to my sidebar
  5. I looked at the default_navigation_menu_categories site setting
  6. As you say in the guide I removed all categories


and applied the change to everyone

7. Now the setting was empty

8. I checked my sidebar and only category4 which was added manually was in there (also the link to the site setting at the bottom indicates that the site setting is empty)

9. I waited ~45 minutes and added category1, category2 and category3 to the setting

and applied the change to all users

Expected result based on the title of this guide: all users have the same categories in their sidebar which means the ones in the setting and nothing else.
Actual result: category4 is still in the sidebar, while it is not in the sidebar for users who haven’t added it manually.

In which step do you expect the category the user added (in my example category4) to their sidebar to be removed to get the result of all users having the same categories in their sidebar?

Based on what you said here, I don’t expect it to be removed, because the category is not removed from the setting because it wasn’t in it. But you say you used those steps to enforce the same categories for all users.
If I added all categories (method 1) category4 would have been added and removed, so I would expect it to disappear. That’s where I understand what happens. But your guide says I should use method 2, so I wonder what I am missing in my understanding and my testing.

1 Like

@moin how are you feeling about this guide now, does it answer all that needs answering? is it too wordy? not wordy enough?

(I am working on a bot to align our docs with actual code and refresh screenshots)