Allow adding new tabs at the bottom of user menu

AI-generated summary

Lumi requests an API enhancement to allow placing custom tabs at the bottom of the user menu, alongside the user profile tab, rather than grouped with notifications in the top section. Previously, using addUserMenuGlyph and a custom widget from QuickAccessPanel, Lumi could place theme-switching controls in the old menu. Now, using registerUserMenuTab and extending UserMenuTab, the custom tab appears mid-menu among notifications, which is not ideal for user settings. Lumi clarifies that while modifying the UserMenu class directly might work, adding this functionality to the API would be more sustainable. They suggest introducing a new insertion point—above the profile tab—as a practical compromise if exact positioning isn’t feasible. Lilly confirms confusion over whether the request pertains to the user menu or preferences, and expresses interest in seeing a solution that allows control over tab placement. Lumi references the relevant code in the Discourse repository, highlighting the current insertion logic at line 207 of menu.js. The core issue is about improving API flexibility to better separate settings from notifications in the user menu layout.

In the old user menu, I added a glyph and a repurposed notification panel, from which a user could easily change the theme (we have a bunch of those). I would like to do the same in the new menu, but if I add a custom menu tab via the api, it will be grouped among the notifications in the top tabs. Because it’s a user setting, I would like it to be in the bottom section with the user profile tab. Is there any chance you could add an api function for that?

2 Likes

As a clarification, I was using addUserMenyGlyph and creating a new widget from the QuickAccessPanel-widget. The best current replacement is to use registerUserMenuTab and create a new class from the UserMenuTab, but the new tab ends up in the middle of the notifications (not ideal, when it contains settings, not notifications). I would like to have more control over where the tab is placed in the menu.

1 Like

yea i couldn’t tell from your original post if you mean the user menu or the user preferences tabs. i sort of assumed you went from the addUserMenuGlyph to using the UserMenuTab create class (if you meant the user menu) but i couldn’t see where the api inserts the tab. i’m interested to see if there is a way to solve this and control where a tab would go.

1 Like

Thanks! I could probably make this work by modifying the UserMenu class, but I think it might be useful to include this in the api. Currently the custom tabs are inserted right above the other notifications tab. While exact positioning may not be feasible, there could be another insertion point above the profile tab.

https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/components/user-menu/menu.js#L207

1 Like