• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 Customfields on CSS


I want to know how the recovered {$user.customFields.field_id} a custom, to put in a CSS class field, the field requires a personalized color in hex format.

thank you


Well-known member
Hopefully you can learn from this if it's what you're looking for

See the profile background image on the top right


We've edited member_view, found:

<div class="mainText secondaryContent">
We added the custom field check:

<div class="mainText secondaryContent<xen:if is="{$user.customFields.profilepic}"> {$user.customFields.profilepic}</xen:if>">
Then our css:

.primaryUserBlock .dayz1
   background: url(@imagePath/xenforo/profileimages/dayz1.png) no-repeat top right #0D0D0D;
.primaryUserBlock .dayz2
   background: url(@imagePath/xenforo/profileimages/dayz2.jpg) no-repeat top right #0D0D0D;
.primaryUserBlock .dayzinfection
   background: url(@imagePath/xenforo/profileimages/dayzinfection.jpg) no-repeat top right #0D0D0D;
Finally the custom fields part:



So.. this basically adds an extra class to the little container in member_view if they have a custom field selected, and you can style that container differently.

Sorry if it's not what you're looking for... but same concept if I understand correct, or I need coffee

EDIT- I do need coffee, sorry for a color selection field on the profile you'd need an add-on for that, however you could define a pre-set list of colors to add as a class name.
Thank you for these explanations, but I'm looking to change the default color of the font in messages, so I add extra.css the class that replaces the default, and I would like the member in his profile can choose a color, and that it applies in its messages, but I can not put this in place.

I just read your ps, no worries, but I'm not ocdeur php, I do not know how made an addon for that, thank you again.