This theme component allows an admin to add flair to user avatars based on the user’s trust level. Trust level flair displays anywhere on the site that you would normally see group flair. There are a few theme settings to adjust the position of the flair in relation to the avatar.
Basic Examples (with group flair in place)
There is also a bottom-right position that will either replace group flair or be replaced by group flair depending on how you set the “group flair always on top” setting.
IMPORTANT: You must be running Discourse Version 2.0.0.beta4 or later for this theme to work.
Due to current limitations, this will have to be somewhat of a “theme-ception.” There will be two theme components: one for the overall implementation of trust-level flair and one for the flair image assets. The image assets theme component will be set as a child theme of the main trust-level flair theme component.
Take a look at this for instruction on how to install the two theme components:
You will need to add your own flair images to the image assets theme component. A good size is around 100×100px. The one I used in the example is 88×88px. There is a transparent placeholder image by default that can be replaced for all the trust levels. You can do this by clicking the + Add button under Uploads, choosing your image, and finally entering the appropriate name. Make sure to name the images:
This will replace the placeholders and you will be set!
To add the image assets theme to the main theme, select the main trust-level flair theme in your admin panel and look near the bottom of the settings for a section called “Theme Components.” Select and add the theme called “Trust-Level Avatar Flair Image Assets” It should look like this:
There are settings to adjust the flair’s position relative to a user’s avatar and any existing group flair, as well as the ability to set custom tooltip text when hovering over the trust-level flair:
This was inspired by the discussion started here:
To-Do and Future Ideas
Figure out how to get the flair to display in the topic map appropriately (will be posting on the dev category soon cause I’m out of ideas!)(Unless there is clear indication of a need for this, I don’t think this is really necessary given how busy it can get on the topic map avatars by default.)
- Switch from template override to plugin outlet once the next version of Discourse drops with the outlet for profile avatar flair
- Add setting for smaller flair sizes? (If there’s any interest)
Please feel free to post if there are any questions, problems, or suggestions!