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

Customize Custom User Field Title

#1
How can I customize the title of a single custom user field?

For example, if I had a customer user field that showed up in postbit like this:

Favorite Color:
Red

How do I change "Favorite Color:"?
I couldn't seem to figure it out using Value Display HTML. I could only manage to change the color of "Red".​
 

Jake Bunce

XenForo moderator
Staff member
#4
This is the template for the postbit:

Admin CP -> Appearance -> Templates -> message_user_info

All of the custom fields use the same code. But you can use a condition to check the field_id. Add the red code:

Code:
			<xen:if is="@messageShowCustomFields AND {$user.customFields}">
			<xen:hook name="message_user_info_custom_fields" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
			
				<xen:foreach loop="$userFieldsInfo" key="$fieldId" value="$fieldInfo">
					<xen:if is="{$fieldInfo.viewable_message}">
						<xen:if hascontent="true">
							<dl class="pairsInline userField_{$fieldId}">
								<dt>{xen:if "{$fieldId} == 'field_id'", "TITLE HERE", {xen:helper userFieldTitle, $fieldId}}:</dt>
								<dd><xen:contentcheck>{xen:helper userFieldValue, $fieldInfo, $user, {$user.customFields.{$fieldId}}}</xen:contentcheck></dd>
							</dl>
						</xen:if>
					</xen:if>
				</xen:foreach>
				
			</xen:hook>
			</xen:if>
You need to specify the field_id and the title you want to use. It's dirty but it works.