XenForo Personal banner

</clown>

Loyal Member
1. Create two additional fields for banner title and banner color.
Field ID: p_banner
Title: Personal Banner Header
Display location: Personal details
Display order: 1
Field Type: Single-line text box
Value Matching Requirement: None
Only "Can be edited by a moderator" should be checked in the "General options".
image14b9162a7445e93c.md.png

Now for the color of the banner
Field ID: p_banner_color
Title: Personal Banner Color
Display location: Personal details
Display order: 2
Field Type: Radio buttons
Value Matching Requirement: Color
"Choices field settings" see on the screenshot
"Basic settings" as above
The HTML for the value output: {$choice}
imaged6c609dc422b3cf3.md.png

imagec522c3287511fbe8.md.png

Then make template modifications, message_macros, find:
Code:
        <div class="message-userDetails">
            <h4 class="message-name"><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" /></h4>
            <xf:usertitle user="$user" tag="h5" class="message-userTitle" banner="true" itemprop="jobTitle" />
            <xf:userbanners user="$user" tag="div" class="message-userBanner" itemprop="jobTitle" />
            <xf:if is="{$dateHtml}"><div class="message-date">{$dateHtml}</div></xf:if>
replace:
Code:
        <xf:if is="{$user.Profile.custom_fields.p_banner} AND {$user.Profile.custom_fields.p_banner_color}">                               
            <div class="userBanner userBanner--{$user.Profile.custom_fields.p_banner_color} message-userBanner" dir="auto" itemprop="jobTitle">
                <span class="userBanner-before"></span>
                <strong>{$user.Profile.custom_fields.p_banner}</strong>
                <span class="userBanner-after"></span>
            </div>
        </xf:if>

In the member_view template we find:
Code:
                        <xf:if contentcheck="true">
                            <div class="memberHeader-banners">
                                <xf:contentcheck><xf:userbanners user="$user" /></xf:contentcheck>
replace:
Code:
                                <xf:if is="{$user.Profile.custom_fields.p_banner} AND {$user.Profile.custom_fields.p_banner_color}">
                                    <em class="userBanner userBanner--{$user.Profile.custom_fields.p_banner_color}" dir="auto">
                                        <span class="userBanner-before"></span>
                                        <strong>{$user.Profile.custom_fields.p_banner}</strong>
                                        <span class="userBanner-after"></span>
                                    </em>
                                </xf:if>

Result:
image15db7a4b42409c68.md.png
 
Back
Top Bottom