How can I add a new item to the user dropdown menu? Can I personalize and add a new item there?
AI-generated summary
In a support discussion titled ‘Add new item to user dropdown menu,’ miguelbemartin asks how to add a customizable item to the user dropdown menu. Moin responds by directing them to the plugin-API and suggests using a custom theme component to inject JavaScript code. Moin provides an example snippet using api.addQuickAccessProfileItem to add a menu item with an icon and link. miguelbemartin reports an error when using the code in the Horizon theme. Moin clarifies that the code should be placed inside the apiInitializer function’s callback, replacing the placeholder comment, and corrects the syntax. The corrected example includes adding an item with a pencil icon linking to ‘/compose’. The discussion highlights the proper structure for extending Discourse’s user menu via theme components.
Welcome to Meta ![]()
You can use the plugin-API to add a new link to that menu. You can, for example, do that directly in the admin interface by creating a new theme component and adding something like this to the JS tab:
api.addQuickAccessProfileItem({
icon: "pencil",
href: "/somewhere",
content: "Title"
})
Yes, sorry, I made a mistake when I copied the code.
By default, you see this in the JS tab.
import { apiInitializer } from "discourse/lib/api";
export default apiInitializer((api) => {
// Your code here
});
And then, you put this where the placeholder is.
api.addQuickAccessProfileItem({
icon: "pencil",
href: "/somewhere",
content: "Title"
})
So, the result should look like this:
import { apiInitializer } from "discourse/lib/api";
export default apiInitializer((api) => {
api.addQuickAccessProfileItem({
icon: "pencil",
href: "/somewhere",
content: "Title"
})
});
Above, I had accidentally copied one of the default lines.



