Adding Certain Profile Fields to Member Card

Jake Bunce

XenForo moderator
Staff member
#2
Admin CP -> Appearance -> Templates -> member_card

Add the red code near the bottom:

Rich (BB 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
 

Sadiq6210

Active member
#6
Admin CP -> Appearance -> Templates -> member_card

Add the red code near the bottom:

Rich (BB 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:

View attachment 21560
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
 

Sadiq6210

Active member
#7
Admin CP -> Appearance -> Templates -> member_card

Add the red code near the bottom:

Rich (BB 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:

View attachment 21560
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.

View attachment 125574
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>
 
Top