XF 1.5 Custom User Field Default Value?


Active member
I know you can't do it from the configuration, but is there a template trick to set a default value on a custom user field when a new account is created? I have several moderator-editable only field that displays in the member profile. It has a value from 0 - 5. I want it to default at 0.

Or alternatively, on the member profile, can you display all of the custom fields available, regardless of whether or not its set?

Chris D

XenForo developer
Staff member
For something like this you would have to explicitly disable its display, and edit the template/s to show the value where you want.

<dl class="pairsJustified userField_FIELD_ID">
    <dt>{xen:helper userFieldTitle, FIELD_ID}:</dt>
    <dd>{xen:number $user.customFields.FIELD_ID}</dd>

Replacing FIELD_ID with whatever the ID of the field is.

{xen:number} is important here as it will force a numerical value, e.g. an empty string would display 0.