I’m struggling to learn more about how discourse works and I’m still confused after reading this. I’m trying to add a dynamic title to the admin’s username on the post page using jQuery but is not working.
But if I’ll target let’s say the body tag, and add a class, it works.
So can somebody please explain why is not working?
The code is inserted in the header tab btw.
Thanks for your help. Not the actual forum title I’m looking for but to display a title on hover on this little crown icon I made ( visible only for admins ):
It’s significantly more effort to do this kind of thing in Discourse because it is an auto-magical-web-app, but once you do it right, the solution can be very robust.
Awesome, thanks a lot. I’ll take a look and post the solution if I’ll succeed. At first sight, Discourse looks so scary when it comes to customizing, and I thought WordPress is difficult .But, for sure once I’ll get familiar with all this plugins-templates thing, I guess it will become easier.
But this will remove the shield icon for moderators, right? Cause I don’t want that. I need to add that crown icon and the hovering text only for admins since they don’t have any at all on the posts page.
Ah, yeah, I’m too used to my sites where I’m both a mod and an admin. If you split these roles that won’t work (ie Admin’s are never mods). You’d need to give Admins mod rights.
In this case the first user is both admin and mod, second is just admin. You can embellish that logic; make the crown take precedence by switching the order of the if statements.
Sounds like a solution but as I said I’m new to customizing Discourse…can you please explain where exactly do I need to paste your code cause I didn’t try any API method so far.
I’ve updated the TC so it now changes the staff icons on the User Card too (and possibly other places since I’ve modified the helper).
The icons are now configurable for both the admin and the moderator, though crown is the default for admin whilst moderator’s default is vanilla shield.
I’ve renamed the TC.
There are bound to be places where the icons are not converted, perhaps I’ll catch more in the future.
Thank you so much! This helped me with what I wanted to do for my Forum! I think your comment should be pinned for other users that are having issues with an icon displaying next to their name as an Admin. I used your feature to display the shield icon that is publicly shown on Moderators profile for Admins. Now, I can have the shield Icon without having Moderator Permissions and it has the correct Admin Tooltip when I only have the Admin Permissions. Thank so much for your time to create this Awesome component for people’s forums!
Edit: It does Not show publicly on their profile. It’s currently only working on posts.