XF 2.1 Add usergroup--styleid css <span> to all usernames


Well-known member
I'm having a heck of time figuring something out and hoping someone can help. I'm looking to create a custom addon if that's what needed, but at this point I'm unsure if this is something that can be accomplished through the core and admin area.

I want to be able to put icons before usernames which is easy for "staff", but for regular usergroups, the <span> class doesn't appear for must users when their username is rendered.

For staff and admins we have the following which makes it easy:

<a href=""><span class="username--staff username--admin">DavidTemp</span></a></h4>

I'd like to have my Usergroup ID's in a similar fashion when appearing in most places around the forum:

<a href=""><span class="username--usergroup4">Some_Username</span></a></h4>

I've noticed that sometimes users get the following (XX being their usergroup ID), but I'm yet to be able to figure when or why:

<a href=""><span class="username--styleXX">Some_Username</span></a></h4>

Help me :)
For anyone curious, I've discovered that this can be accomplished in the core. No add-on needed.

The following appears ONLY when the UserGroup "Display Styling Priority" has the highest value. If you leave it at the default 0, it won't appear. If the Default Styling Priority is higher, it will appear. Furthermore, given users can be a member of multiple Usergroups, the highest priority styling will be given to the <span> class.

Below, where XX is the highest display priority for any of the usergroup ID's within their given usergroups.
<a href=""><span class="username--styleXX">Some_Username</span></a></h4>

Note, in order for the <span> to appear, you must set something for "User name CSS" in the usergroup options.
Top Bottom