I would like to add a direct link to the users activity page to the user dropdown menu, either as an icon:
Or as text.
How do I do it?
Customizing the User Dropdown Menu
tophee is looking to add a direct link to the user activity page in the user dropdown menu. zogstrip provides a solution using a CSS/HTML customization with a script that adds a user menu item.
To include the username in the href path, zogstrip suggests using /my/activity. For composing the label, zogstrip recommends referencing existing localizations in the client.en.yml file. tophee notes that nested localizations should be referenced with a dot notation (e.g., user.activity_stream).
The solution also applies to the mobile version, as zogstrip confirms that the </head> customization works for both desktop and mobile.
Additionally, mentalstring asks about customizing the profile quick access menu and receives no direct answer, but bekircem provides a link to a related topic on customizing the hamburger menu.
Create a new CSS/HTML customization, and put this in “</head>”
<script type="text/discourse-plugin" version="0.4">
api.addUserMenuGlyph({
label: 'awesome.label',
className: 'my-class',
icon: 'your-icon',
href: `/some/path`
});
</script>
How do I write the href path if it includes the username (as in /users/username/activity)?
Note to anyone wanting to use this: if you use an fontawesome icon, you give the icon name without the leading fa-
You can cheat and use “/my/activity” ![]()
And how do I compose the label properly (so that I can draw on existing localizations)?
And what about the mobile version? There is no <\head> in the mobile version…
You can have a look at the client.en.yml file if you want to use existing localizations.
“</head>” works for both.
Excellent! Based in what I saw in client.en.yml, I tried label: 'activity_stream' but it didn’t work. label: 'activity' works.
That’s because “activity_stream” is under “user” and should thus be referenced as “user.activity_stream” ![]()
You are a great teacher. Thank you very much!
Same method for that?