In 2009, I submitted an article titled "
[vBulletin 3x] Style-Specific Rank Images." In that article, I showed vBulletin administrators how to bypass the software's limitations to use a different set of rank images for each forum style without having to resort to using replacement variables. The drawback to this method, however, was that the rank images would no longer display on the profile page (or the "memberinfo" page, as administrators may refer to it). In other words, the following code, which worked for the "postbit" or "postbit_legacy" file, was not working for the "memberinfo" file:
Code:
<if condition="$post['rank']"><div class="smallfont">$post[rank]</div><if condition="$post[usergroupid]==6"><img src="enlighten/ranks/stars_orange.gif"/></if><if condition="$post[usergroupid]==5"><img src="enlighten/ranks/stars_red.gif"/></if><if condition="$post[usergroupid]==27"><img src="enlighten/ranks/stars_0.gif"/></if><if condition="$post[usergroupid]==15"><img src="enlighten/ranks/stars_1.gif"/></if><if condition="$post[usergroupid]==16"><img src="enlighten/ranks/stars_1.gif"/></if><if condition="$post[usergroupid]==17"><img src="enlighten/ranks/stars_2.gif"/></if><if condition="$post[usergroupid]==18"><img src="enlighten/ranks/stars_2.gif"/></if><if condition="$post[usergroupid]==19"><img src="enlighten/ranks/stars_3.gif"/></if><if condition="$post[usergroupid]==20"><img src="enlighten/ranks/stars_3.gif"/></if><if condition="$post[usergroupid]==21"><img src="enlighten/ranks/stars_4.gif"/></if><if condition="$post[usergroupid]==22"><img src="enlighten/ranks/stars_4.gif"/></if><if condition="$post[usergroupid]==23"><img src="enlighten/ranks/stars_5.gif"/></if></if>
Now, it was important that I reprint the above code, as there are several alterations that must be made to it in order for it to work on the profile (or "memberinfo") page.
First, I had to figure out why the rank text was not displaying. The rank text, by the way, is represented by the following segment of the above code:
Code:
<if condition="$post['rank']"><div class="smallfont">$post[rank]</div>
The first problem with this code is that it uses the "$post" variable, which apparently will not work because it applies to the "postbit" and "postbit_legacy" files, but
not the "memberinfo" file. Well, then, what to replace it with? I noticed that the variable being used for profile information was "$prepared", so I made the following alteration to the above segment:
Code:
<if condition="$prepared['rank']"><div class="smallfont">$prepared[rank]</div>
But wait! There's still a problem. The rank text, though it will now display, will appear differently than how it is normally shown on the profile page. If you like the small text, by all means keep it, but if you'd rather keep to the traditional look, replace
Code:
<div class="smallfont">$prepared[rank]</div>
with
Code:
<div id="rank">$prepared[rank]</div>
Since that's now out of the way, I'll show what's wrong with the rest of the code.
Code:
<if condition="$post[usergroupid]==6"><img src="enlighten/ranks/stars_orange.gif"/></if><if condition="$post[usergroupid]==5"><img src="enlighten/ranks/stars_red.gif"/></if><if condition="$post[usergroupid]==27"><img src="enlighten/ranks/stars_0.gif"/></if><if condition="$post[usergroupid]==15"><img src="enlighten/ranks/stars_1.gif"/></if><if condition="$post[usergroupid]==16"><img src="enlighten/ranks/stars_1.gif"/></if><if condition="$post[usergroupid]==17"><img src="enlighten/ranks/stars_2.gif"/></if><if condition="$post[usergroupid]==18"><img src="enlighten/ranks/stars_2.gif"/></if><if condition="$post[usergroupid]==19"><img src="enlighten/ranks/stars_3.gif"/></if><if condition="$post[usergroupid]==20"><img src="enlighten/ranks/stars_3.gif"/></if><if condition="$post[usergroupid]==21"><img src="enlighten/ranks/stars_4.gif"/></if><if condition="$post[usergroupid]==22"><img src="enlighten/ranks/stars_4.gif"/></if><if condition="$post[usergroupid]==23"><img src="enlighten/ranks/stars_5.gif"/></if></if>
The problem here is that the "$post" variable is once again being used. The "$prepared" variable will not work in this case, though.
When thinking about what to replace it with, then, I searched for "usergroup profile variable" at several vBulletin support sites. At first, "$bbuserinfo" seemed like a promising variable, but it showed only one rank image and text regardless of the conditionals. So the search continued until I found the following post at vBulletin.com submitted in 2007: "
[D]isplay postbit/profile variables on forumhome?" In the first post of that topic, the following was said (emphasis mine):
Quote:
|
I searched and found the difference between having these variables show up in different locations, like $post in postbit and $userinfo in a user's profile, but can I have these variables work on any other page, mainly FORUMHOME?
|
As you most likely gathered, it became obvious to me that the variable "$userinfo" should be used to replace "$post" before every instance of "[usergroupid]". With this change, and the one made above for instances of "['rank']", the code I originally created for the postbit templates now looked like this:
Code:
<if condition="$prepared['rank']"><div id="rank">$prepared[rank]</div><if condition="$userinfo[usergroupid]==6"><img src="enlighten/ranks/stars_orange.gif"/></if><if condition="$userinfo[usergroupid]==5"><img src="enlighten/ranks/stars_red.gif"/></if><if condition="$userinfo[usergroupid]==27"><img src="enlighten/ranks/stars_0.gif"/></if><if condition="$userinfo[usergroupid]==15"><img src="enlighten/ranks/stars_1.gif"/></if><if condition="$userinfo[usergroupid]==16"><img src="enlighten/ranks/stars_1.gif"/></if><if condition="$userinfo[usergroupid]==17"><img src="enlighten/ranks/stars_2.gif"/></if><if condition="$userinfo[usergroupid]==18"><img src="enlighten/ranks/stars_2.gif"/></if><if condition="$userinfo[usergroupid]==19"><img src="enlighten/ranks/stars_3.gif"/></if><if condition="$userinfo[usergroupid]==20"><img src="enlighten/ranks/stars_3.gif"/></if><if condition="$userinfo[usergroupid]==21"><img src="enlighten/ranks/stars_4.gif"/></if><if condition="$userinfo[usergroupid]==22"><img src="enlighten/ranks/stars_4.gif"/></if><if condition="$userinfo[usergroupid]==23"><img src="enlighten/ranks/stars_5.gif"/></if></if>
Finally, the code became ready for placement in the "memberinfo" file (found in Admin CP > Styles & Templates > Style Manager > Edit Templates > Member Info Templates). When I opened "memberinfo," I looked for the code shown below, made sure it was highlighted, and then replaced it with the code shown above.
Code:
<if condition="$prepared['rank']">
<div id="rank">$prepared[rank]</div>
</if>