Checking if custom field is set to a value?

realwx

Member
Right now I'm editing the XenForo templates to check to see if a user field is entered. It is a dropdown in "Preferences" with values correlating with 4 for Group A, 5 for Group B, etc. I'm using <xen if="{$user.customFields.a_field_in_preferences} == '4'">...</xen:if>, however {$user.customFields.fieldname} is usually blank. This is in relation to editing a template for the postbit section. Is there a separate variable I'm missing?

(Sorry if I'm making a lot of posts, still new to xenforo programming and everything.)
 
The default value is blank, yes. I'm trying to do a template where if the field is set, display an image like:

Code:
<xen:if="{$user.customFields.preferenceField} == '4'">
<img src="/path/to/image.png" />
</xen:if>

No matter what is picked for "preferenceField" for the user, the variable's value is always blank. What I'm wondering is if I have the wrong name of it, or whether you can't fetch custom personal details/contact info/preferences fields in postbit?
 
Top Bottom