How to customize the user dropdown menu?


(Christoph) #1

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?


(Régis Hanol) #2

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>

Customizing About page and other pages
(Christoph) #3

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-


(Régis Hanol) #4

You can cheat and use “/my/activity:wink:


(Christoph) #5

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…


(Régis Hanol) #6

You can have a look at the client.en.yml file if you want to use existing localizations.

</head>” works for both.


(Christoph) #7

Excellent! Based in what I saw in client.en.yml, I tried label: 'activity_stream' but it didn’t work. label: 'activity' works.


(Régis Hanol) #8

That’s because “activity_stream” is under “user” and should thus be referenced as “user.activity_stream:wink:


(Christoph) #9

You are a great teacher. Thank you very much!


#10

Same method for that?