Style-Specific Rank Images

Medora

The New Architect
Joined
Feb 8, 2006
Messages
1,998
Medora submitted a new Article:

Style-Specific Rank Images

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," informs the reader that, by inserting a certain code into the "postbit"—or "postbit_legacy", if user info is aligned to the left of each post— template, you can get any icon to appear based on what user group that member belongs to (e.g., Administrator, Moderator, Member, and etc).

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>
The person who provided this code said that "x" should be replaced by the user group ID (found in drop-down box in AdminCP > Usergroups). In addition, "IMG VAR HERE" should be replaced with the HTML for the image you want to display (more on that below).

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>
As you know, that last line starting with "<if" and ending with "</div>" is what displays the text rank under your user name...

Read more about this article here...
 
Last edited by a moderator:
Top