1. 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

Discussion in 'Styling and Customization Questions' started by TRACKMIXERS, Mar 27, 2012.

  1. TRACKMIXERS

    TRACKMIXERS Member

    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".​
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Users -> Custom User Fields -> [click the field] -> Title
     
  3. TRACKMIXERS

    TRACKMIXERS Member

    Thanks Jake. That works but then the code becomes part of the title, which shows up under personal details. Any suggestions?
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
  5. TRACKMIXERS

    TRACKMIXERS Member

    Thank you, Jake.
     

Share This Page