1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
Dismiss Notice
Welcome to XenForo 1.5!

For more information, click here.

Adding Certain Profile Fields to Member Card

Discussion in 'Styling and Customization Questions' started by Ranger375, Nov 17, 2011.

  1. Ranger375

    Ranger375 Well-Known Member

    Is this possible? If so, how? :D
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Admin CP -> Appearance -> Templates -> member_card

    Add the red code near the bottom:

    Code:
    		<xen:if is="{$canViewOnlineStatus}">
    			<dl class="pairsInline lastActivity">
    				<dt>{xen:phrase x_was_last_seen, 'username={$user.username}'}:</dt>
    				<dd>
    					<xen:if is="{$user.activity}">
    						<xen:if is="{$user.activity.description}">
    							{$user.activity.description}<xen:if is="{$user.activity.itemTitle}"> <em><a href="{$user.activity.itemUrl}" class="concealed">{$user.activity.itemTitle}</a></em></xen:if>,
    						<xen:else />
    							{xen:phrase viewing_unknown_page},
    						</xen:if>
    						<xen:datetime time="{$user.effective_last_activity}" class="muted" />
    					<xen:else />
    						<xen:datetime time="{$user.effective_last_activity}" />
    					</xen:if>
    				</dd>
    			</dl>
    		</xen:if>
    		<xen:if hascontent="true">
    			<dl class="pairsColumns lastActivity">
    			<xen:contentcheck>
    				<xen:if is="{$user.customFields.field_id}">
    					<dt>Field Name:</dt>
    					<dd>{$user.customFields.field_id}</dd>
    				</xen:if>
    			</xen:contentcheck>
    			</dl>
    		</xen:if>
    	</div>
    	
    	<a class="close OverlayCloser"></a>
    </div>
    
    You need to specify the field_id of the profile field, and type in the Field Name to give it a label. You can add more instances of the blue code inside of the red code to show multiple fields.

    The result:

    Screen shot 2011-11-20 at 1.10.37 PM.png
     
  3. Ranger375

    Ranger375 Well-Known Member

    Awesome, thank you
     
  4. JamesBrown

    JamesBrown Well-Known Member

    How could I show the users Unique ID number here? Thanks
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The user_id?

    Code:
    {$user.user_id}
    
     
  6. sadiq6210

    sadiq6210 Active Member

    I have a custom field with drop down selection, note that "field id" will not be displayed to the users.
    I want to display the "field text" not the "field id" because I cannot use non English letters in field id.

    upload_2016-1-5_11-15-22.png
     
  7. sadiq6210

    sadiq6210 Active Member

    I modified the code and it is working perfect now

    I just replaced this:
    Code:
    <dd>{$user.customFields.field_id}</dd>
    with this:
    Code:
    <dd>{xen:helper userFieldValue, $userFieldsInfo.field_id, $user, {$user.customFields.field_id}}</dd>
     

Share This Page