• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.2 User banner text conditionals

Andy.N

Well-known member
#1
I have a custom usergroup which I create a user banner for with a default text.
I'd like to learn how to modify the message_user_info template and use conditionals so that the text will change depends on different variables.

This is the bit that I need to change
Code:
<xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
        <h3 class="userText">
            <xen:username user="$user" itemprop="name" rich="true" />
            <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user, 1, 1}</xen:contentcheck></em></xen:if>
            {xen:helper userBanner, $user, 'wrapped'}
            <!-- slot: message_user_info_text -->
        </h3>
    </xen:hook>
So something like if {$user.qntquiz_passed.22} then the user title would be "ABC"
if else {$user.qntquiz_passed.23} the title would be "XYZ" and so on.

Thank you
 

Andy.N

Well-known member
#4
Are you trying to change the user banner or the user title?
You can see it in action here
Each user banner text is different based on the conditions. They all belong to one secondary usergroup.
Right now, I depend on the [RT] User Ribbon addon and use conditions to check.
I'd like to get rid of the addon and rely on the new user group banner directly.
 

Jeremy

Well-known member
#9
Use your browsers inspector (or view the page source) to copy one of the banners HTML. Then write a conditional (see @Brogan's resource on conditional statements) to change them.

Its a template edit and really using the new system.