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

XF 1.1 Setting up rank ladder

Discussion in 'Troubleshooting and Problems' started by Hyperion, Jan 10, 2012.

  1. Hyperion

    Hyperion Active Member

    Hi.

    I imported my forum from vBulletin 3.x to xenForo 1.0 (later updated to 1.1). The only problem I have had so far is properly setting up user groups so that the right rank text and rank image shows up on the thread pages. Here is my rank ladder:

    rankladder.png

    I used the following code (inserted in message_user_info) to get those rank images to display on the thread pages:

    Code:
    <div align="center">
    <!-- Start User Ranks -->
    <xen:if is="{$user.is_admin}">
    <span class="userrank"><img src="enlighten/ranks/stars_orange.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.is_moderator} AND !{$user.is_admin}">
    <span class="userrank"><img src="enlighten/ranks/stars_red.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 27">
    <span class="userrank"><img src="enlighten/ranks/stars_0.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 15">
    <span class="userrank"><img src="enlighten/ranks/stars_1.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 16">
    <span class="userrank"><img src="enlighten/ranks/stars_1.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 17">
    <span class="userrank"><img src="enlighten/ranks/stars_2.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 18">
    <span class="userrank"><img src="enlighten/ranks/stars_2.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 19">
    <span class="userrank"><img src="enlighten/ranks/stars_3.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 20">
    <span class="userrank"><img src="enlighten/ranks/stars_3.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 21">
    <span class="userrank"><img src="enlighten/ranks/stars_4.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 22">
    <span class="userrank"><img src="enlighten/ranks/stars_4.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 23">
    <span class="userrank"><img src="enlighten/ranks/stars_5.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 30">
    <span class="userrank"><img src="enlighten/ranks/stars_lavender.gif"></span>
    </xen:if>
    <!-- End User Ranks -->
    </div>
    The rank image correctly corresponding to the usergroup the member is in shows up on the thread pages, but there are two problems.

    First, for some reason anyone who does not have the Administrator or Former Staff rank has the text rank SD Pathogen below her user name, even if she is in a different usergroup and the rank image clearly indicates that she is in a different usergroup, and even if I manually change her primary or secondary usergroup.

    Second, if I go into a member's profile, make Registered the primary usergroup, and select one of the custom usergroups shown above as her secondary usergroup, the rank image no longer shows up for that member. I even tried changing the code shown above by adding another conditional for the Registered usergroup, but to no effect.

    I am not sure what other information I should be including, so please let me know if there is anything else I should share.

    Any idea what the problem may be?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Check that the members in question don't have custom titles set - that will override user group titles.

    Also, you need to use this conditional statement, which will work for primary and secondary groups:
    <xen:if is="{xen:helper ismemberof, $visitor, x}">
     
    Hyperion likes this.
  3. Hyperion

    Hyperion Active Member

    Thank you. My second problem is now fixed (more details about my first below). I made the following change to the code:

    Code:
    <div align="center">
    <!-- Start User Ranks -->
    <xen:if is="{$user.is_admin}">
    <span class="userrank"><img src="enlighten/ranks/stars_orange.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.is_moderator} AND !{$user.is_admin}">
    <span class="userrank"><img src="enlighten/ranks/stars_red.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 27}">
    <span class="userrank"><img src="enlighten/ranks/stars_0.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 15}">
    <span class="userrank"><img src="enlighten/ranks/stars_1.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 16}">
    <span class="userrank"><img src="enlighten/ranks/stars_1.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 17}">
    <span class="userrank"><img src="enlighten/ranks/stars_2.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 18}">
    <span class="userrank"><img src="enlighten/ranks/stars_2.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 19}">
    <span class="userrank"><img src="enlighten/ranks/stars_3.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 20}">
    <span class="userrank"><img src="enlighten/ranks/stars_3.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 21}">
    <span class="userrank"><img src="enlighten/ranks/stars_4.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 22}">
    <span class="userrank"><img src="enlighten/ranks/stars_4.gif"></span>
    </xen:if>
     
    <xen:if is="{xen:helper ismemberof, $user, 23}">
    <span class="userrank"><img src="enlighten/ranks/stars_5.gif"></span>
    </xen:if>
     
    <xen:if is="{$user.user_group_id} == 30">
    <span class="userrank"><img src="enlighten/ranks/stars_lavender.gif"></span>
    </xen:if>
    <!-- End User Ranks -->
    </div>
    Only the first problem remains now. Here is an example of one of my members indicated as an SD Pathogen even though he is not in that usergroup:

    usergroup1.png

    Here is how I set up his usergroups in his profile:

    usergroup2.png

    I checked his profile to see if any custom user title is present, but it is not. The strangest part about this is that the SD Pathogen designation appears for all members who do not have a custom user title (same thing on the Members page), and no matter what primary or secondary user group they are in. Perhaps SD Pathogen is set up as a custom title somewhere else in the AdminCP, and in that way is overriding every other designation?
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

    The user title is either set as a custom title or comes from the user group which the member is in with the highest display styling priority.

    Try rebuilding the user cache.
     
  5. Saeed

    Saeed Well-Known Member

    Is there any way we could use a conditional for post count in the form of ranges, e.g.

    If post count is more than 100 but less than 200, etc?
     
  6. Hyperion

    Hyperion Active Member

    I figured out what the problem was: In my confusion over how to properly set up the rank titles, I figured that I should be using the Trophy User Titles page. As you must have gathered, SD Pathogen was showing up for everyone since the post requirement was 0, whereas for other titles there was the higher post count required. I removed the Trophy User Titles and chose instead to, in the usergroups page, select User Title Override -> Use the following user title: [insert name of user group here].
     
  7. Brogan

    Brogan XenForo Moderator Staff Member

    Saeed likes this.
  8. Saeed

    Saeed Well-Known Member

  9. Brogan

    Brogan XenForo Moderator Staff Member

    <xen:if is="{$visitor.message_count} >= x AND {$visitor.message_count} <= y">
     
    Saeed likes this.
  10. Saeed

    Saeed Well-Known Member

    Brilliant stuff!

    Thanks. :)
     
  11. Brogan

    Brogan XenForo Moderator Staff Member

    I updated it to add another = to the greater than.

    <xen:if is="{$visitor.message_count} >= x AND {$visitor.message_count} <= y">
     
    Saeed likes this.
  12. Saeed

    Saeed Well-Known Member

    So we could have two ways of implementing this:

    <xen:if is="{$visitor.message_count} >= 100 AND {$visitor.message_count} <=200">

    <xen:if is="{$visitor.message_count} >= 100 AND {$visitor.message_count} <= 199">
     
  13. Brogan

    Brogan XenForo Moderator Staff Member

    Your second condition only differs by 1 digit for the upper value, with the same criteria.

    I suspect you meant:

    <xen:if is="{$visitor.message_count} > 99 AND {$visitor.message_count} < 200">
    or
    <xen:if is="{$visitor.message_count} >= 100 AND {$visitor.message_count} <= 199">
     
  14. Saeed

    Saeed Well-Known Member

    My bad, that was indeed what I meant. :)
     
  15. Saeed

    Saeed Well-Known Member

    Well, I tried this on my forum today.

    e.g. an image for all members who have a post counts >=10000 and <12000.

    This is what I put in message_user_info:

    However, the problem is that it shows for all members. Though I can't figure out why. Is there something wrong with the conditional?
     
  16. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Use $user instead of $visitor.
     
    Saeed likes this.

Share This Page