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

Is there a way to link Trophy User Titles to images in the userinfo area?

Discussion in 'Styling and Customization Questions' started by Lone Wolf, Oct 24, 2011.

  1. Lone Wolf

    Lone Wolf Well-Known Member

    I currently use a template edit which allows me to put an image into the user area of a specific usergroup. But I have 20 different images I'd like to use and I dont want to create 20 usergroups, it would be easier to link the images to User Titles instead.

    Currently I edit message_user_info and add the following...

    Code:
    <!-- Start User Ranks -->
    
    <xen:if is="{xen:helper ismemberof, $user, 2}">
    <span class="userrank"><img src="styles/flexile/xenforo/ranks/top_cat.png"></span>
    </xen:if>
    
    <xen:if is="{xen:helper ismemberof, $user, 5}">
    <span class="userrank"><img src="styles/flexile/xenforo/ranks/posting_mad.png"></span>
    </xen:if>
    
    <!-- End User Ranks -->
    What I need is to replace the 'user is member of' field to 'user has trophy title X'

    Does anyone know what command I need to achieve that?
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    There is no function you can use to directly check the trophy title. But you can check the user's title, trophy or not:

    Code:
    <xen:if is="{xen:helper userTitle, $user} == 'title here'">
    
    </xen:if>
    
    Presumably your trophy titles are unique so you can get away with a string compare like this.
     
    Lone Wolf likes this.
  3. Lone Wolf

    Lone Wolf Well-Known Member

    Thanks Jake, that works perfectly. I guess I could hide the user title from public view and let the user rank image do the talking. Do you know how I could do that?

    It's a shame because I was hoping to let users have custom titles and use images as a user ranks system.
     
  4. Lone Wolf

    Lone Wolf Well-Known Member

    Im trying to create a query to add user images for specific users. I've tried the following but neither works...

    Code:
    <xen:if is="{xen:helper user_id, $user} == '3'">
    <span class="userrank"><img src="styles/flexile/xenforo/ranks/admin.png"></span>
    </xen:if>
    Code:
    <xen:if is="{xen:helper username, $user} == 'XFuser'">
    <span class="userrank"><img src="styles/flexile/xenforo/ranks/admin.png"></span>
    </xen:if>
     
  5. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Code:
    <xen:if is="{$user.user_id} == 3">
    
    </xen:if>
    
     
    Lone Wolf likes this.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    You can remove the code for the user title from message_user_info:

    Code:
    <xen:if hascontent="true"><em class="userTitle" itemprop="title"><xen:contentcheck>{xen:helper userTitle, $user}</xen:contentcheck></em></xen:if>
    
     
    Lone Wolf likes this.
  7. Lone Wolf

    Lone Wolf Well-Known Member

    That's the ticket but if there is a user title or usergroup image then you get two images in the user area. I'll just create custom titles and use the custom title instead of the user id to get round that.

    Thanks again Jake!
     

Share This Page