XenForo Personal banner

El Bana

Active member
Registered
Joined
Jul 25, 2024
Messages
142
Reaction score
131
Points
43
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".

1722523925826
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}

1722523951471
1722523959570
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:

1722524018615
 
Back
Top