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.
Grazie mille! Mi hai aiutato con quello che volevo fare per il mio forum! Penso che il tuo commento dovrebbe essere fissato per altri utenti che hanno problemi con un’icona che viene visualizzata accanto al loro nome come amministratore. Ho usato la tua funzionalità per visualizzare l’icona dello scudo che è pubblicamente mostrata sul profilo dei moderatori per gli amministratori. Ora, posso avere l’icona dello scudo senza avere i permessi di moderatore e ha il corretto tooltip dell’amministratore quando ho solo i permessi di amministratore. Grazie mille per il tuo tempo nel creare questo fantastico componente per i forum delle persone!
Modifica: Non viene visualizzato pubblicamente sul loro profilo. Attualmente funziona solo sui post.