1. 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

Discussion in 'Styling and Customization Questions' started by Andy.N, Aug 10, 2013.

  1. Andy.N

    Andy.N Well-Known Member

    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
     
  2. Andy.N

    Andy.N Well-Known Member

    Anyone?
     
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    Are you trying to change the user banner or the user title?
     
  4. Andy.N

    Andy.N Well-Known Member

    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.
     
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

    Can you promote them to different secondary user groups? You'll have to modify a helper (or write your own).
     
  6. Andy.N

    Andy.N Well-Known Member

    I have 10 different titles so don't want to make 10 new secondary usergroups.
    Sounds like I would have to stick with the current implementation.
     
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    You could copy the code and use conditionals to change the text as well.
     
  8. Andy.N

    Andy.N Well-Known Member

    How? Copy the piece of code I posted in OP 10 times?
    That's why I asked ;)
     
  9. Jeremy

    Jeremy XenForo Moderator Staff Member

    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.
     

Share This Page