Different color username for certain members

Divvens

Well-known member
I want to be able to give different username color to certain members without having them in different groups.

As in, x member gets pink, x member gets green and x member gets yellow staying in their respective groups without having additional groups to take over styling.

I offer members a way to change their username colors, and I don't want to have different usergroup with different styling rules.

This would be easy if xf by default offered images to be added in user title's (trophy), but we force user titles via groups and we can't override one group 100% or else the rank tags we have arranged breaks.

So, is there anyway I can give a certain user different username color? By styling rules or special user permissions?
 
You can do it with template edits, depending on how you want it configured. One is to create a custom field and use that to set the color of the username using style="...." or you can use the username as a class, then you can do this with extra.css.
 
You can do it with template edits, depending on how you want it configured. One is to create a custom field and use that to set the color of the username using style="...." or you can use the username as a class, then you can do this with extra.css.
Can that be done for a certain user only? Or would that apply to all, the custom field option sounds good would you tell me how that would be done?
 
In template message_user_info, find:
Code:
        <h3 class="userText">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
            <!-- slot: message_user_info_text -->
        </h3>

The username is generated with the second line, I just tested on my site and adding style="color:red;" etc work, but I am not sure if using custom user fields will. You can try (meaning I have not tested this) by changin it too:
Code:
          <xen:username user="$user" itemprop="name" rich="true" style="color: {$message.customFields.field_id}" />
You have to change field_id to the field you want to use. You should force people to use web colors, though.
 
Code:
<xen:username user="$user" itemprop="name" rich="true" style="color: {$message.customFields.field_id}" />
What would be the right syntax if I wanted the default username (usergroup) color to show UNLESS a unique is specified in the custom field? Or does it work that way with this?
Edit: The edit works, but it doesn't visually show!

http://orojackson.com/threads/good-morning-world-one-post-per-day.43/page-128#post-38837

If you go over the username and check the properties with chrome/firefox, it clearly shows an the new color which the username should use but it still shows the old username color.
 
Yes that will work.

What template are you editing?
I've added the following code on message_user_info
Code:
<xen:username user="$user" itemprop="name" rich="true" style="color: {$message.customFields.usernameColor} !important" />

But as you can see on this post - http://orojackson.com/threads/good-morning-world-one-post-per-day.43/page-128#post-38837 if you check the properties on the username "kurumu-chan", it shows the new color in the attributes but doesn't change the actual username color (from orange to white) [please select the default theme if by chance you have another theme on there, its supposed to be a red-ish theme]

I'll attach two images to explain what I'm talking about :)
nocolorchange.webpstyleattribute.webp
 
Code:
<a href="members/kurumu-chan.451/" class="username" itemprop="name" style="color: #ffffff !important;"><span class="style12">kurumu-chan</span></a>

You've got usergroup markup in there. That creates an inner span with a style class that may override the other inline styling.

Edit your groups and remove any username CSS.
 
Code:
<a href="members/kurumu-chan.451/" class="username" itemprop="name" style="color: #ffffff !important;"><span class="style12">kurumu-chan</span></a>

You've got usergroup markup in there. That creates an inner span with a style class that may override the other inline styling.

Edit your groups and remove any username CSS.
Ah thanks for pointing that out.
 
Top Bottom