Style-Specific Rank Images
by
30 Nov 2009
As someone who used phpBB2 for the longest time, I was surprised to find that vBulletin 3x doesn't make the same accommodations for those who want to add style-specific rank images, or rank images that appear only for the style(s) you want. There was nothing in the "Mods" section that seemed to address the issue, and though there are plenty of requests to be found in the topics lists of vB org, vB com, and other vB sites, the most common answer is that it cannot be done (unless someone submitted a mod). A less frequent response, but the most promising one, is to use the Replacement Variable Manager in the AdminCP. Unfortunately, this method did not work for me. Also, some novice administrators may have trouble properly using replacement variables, as even seasoned vBulletin users acknowledge that it could be tricky. That said, I discovered a method that I think is simpler, and I owe thanks to the user who submitted the helpful post I unexpectedly found in an only somewhat relevant topic from 2004. That post, "vBulletin.org Forum - View Single Post - Groupicons Spoiler (click to open)
Do this instead.
Inside your postbit template add the following to where ever you want the icon to appear. You can see my postbit at vbhacks.us as an example. Change X with the usergroup ID. PHP Code:
<if condition="$post[usergroupid]==x"> IMG VAR HERE </if>
Close
Obviously, since the code is applied to the file ("postbit" or "postbit_legacy") of the one style, the image(s) you choose will only appear in that style. Anyways, here is that code: Code:
<if condition="$post[usergroupid]==x"> IMG VAR HERE </if> Now, using the above code as my starting point, I took a look at the "postbit" template for my forum's default template, Enlighten. The point where the above code should be inserted is inline directly after this: Code:
<if condition="$post['usertitle']"><div class="smallfont">$post[usertitle]</div></if> <if condition="$post['rank']"><div class="smallfont">$post[rank]</div> Code:
<if condition="$post['usertitle']"><div class="smallfont">$post[usertitle]</div></if> <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]==26"><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> Code:
<if condition="$post['usertitle']"><div class="smallfont">$post[usertitle]</div></if> <if condition="$post['rank']"><div class="smallfont">$post[rank]</div><if condition="$post[usergroupid]==6"><img src="images/greenfox/ranks/stars_orange.gif"/></if><if condition="$post[usergroupid]==5"><img src="images/greenfox/ranks/stars_red.gif"/></if><if condition="$post[usergroupid]==26"><img src="images/greenfox/ranks/stars_0.gif"/></if><if condition="$post[usergroupid]==15"><img src="images/greenfox/ranks/stars_1.gif"/></if><if condition="$post[usergroupid]==16"><img src="images/greenfox/ranks/stars_1.gif"/></if><if condition="$post[usergroupid]==17"><img src="images/greenfox/ranks/stars_2.gif"/></if><if condition="$post[usergroupid]==18"><img src="images/greenfox/ranks/stars_2.gif"/></if><if condition="$post[usergroupid]==19"><img src="images/greenfox/ranks/stars_3.gif"/></if><if condition="$post[usergroupid]==20"><img src="images/greenfox/ranks/stars_3.gif"/></if><if condition="$post[usergroupid]==21"><img src="images/greenfox/ranks/stars_4.gif"/></if><if condition="$post[usergroupid]==22"><img src="images/greenfox/ranks/stars_4.gif"/></if><if condition="$post[usergroupid]==23"><img src="images/greenfox/ranks/stars_5.gif"/></if></if> For use at your forum, just replace the usergroup IDs with yours, and replace the directories with the ones you use for each of your templates. There you go: style-specific rank images. I have not tried it, but I wouldn't be surprised if you can even add more than one rank image for a given user group by placing additional image variables inside the conditional for that user group. In any case, please note that the rank image will not display below the text rank in the view member profile page (that is another edit). By Kevin Malone of http://theinfinityprogram.com. |