XF 1.1 Setting up rank ladder

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

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?
 
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}">
 
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.webp

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

usergroup2.webp

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?
 
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.
 
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?
 
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].
 
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">
 
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">
 
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:

<xen:comment><!--Code added by Saeed for Member Ranks starts here--></xen:comment>
<xen:if is="{$visitor.message_count} > 9999 AND {$visitor.message_count} < 12000">
<img src="/Ranks/members/expert.gif">
</xen:if>
<xen:comment><!--Code added by Saeed for Member Ranks ends here--></xen:comment>

However, the problem is that it shows for all members. Though I can't figure out why. Is there something wrong with the conditional?
 
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?

Use $user instead of $visitor.
 
Top Bottom