Welcome to The Infinity Program, a general discussion forum. As the founder, one of my goals is to maintain this community even as others fall to the wayside. Also, I want to encourage engaging conversation by regularly submitting new topics that contain thoughts and insights rather than just aggregated material (if even that).

If you are a first time visitor and want to know more about this place, read the “Guide,” “A Short History of the Forum,” and the highly entertaining “A Brief History of the Universe.” Alternatively, if you want to submit feedback, contact us.

Go Back   The Infinity Program > Miscellaneous > Articles > Webmaster

Webmaster For all articles having to do with maintaining a website. Permissible subjects include, but are not limited to, picking out a host and domain, choosing the software for your message board, designing web pages, and improving SEO.

Reply
 
Article Tools Display Modes
  #1  
Old
Hyperion's Avatar
Hyperion Hyperion is online now
The Face Changer
Administrator
Join Date: Jun 2004
Location: California
Hyperion is on a distinguished road
Default [Profile Add-On] Style-Specific Rank Images
by Hyperion 02 Jun, 2010, 10:10 PM

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>
Reply With Quote
Views 240 Comments 0
Total Comments 0

Comments

Don't have an account? Create a TIP account now to post and access all features—it's quick and easy!

Reply

Lower Navigation
Go Back   The Infinity Program > Miscellaneous > Articles > Webmaster
Reload this Page [Profile Add-On] Style-Specific Rank Images

Tags
addon, images, profile, rank, stylespecific


Currently Active Users Viewing This Article: 1 (0 members and 1 guests)
 
Article Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -7. The time now is 02:41 PM.


vBulletin skins developed by: eXtremepixels
Powered by vBulletin®, Copyright © 2000 - 2010 Jelsoft Enterprises Ltd.
Page generated in 0.35399 seconds with 19 queries


RSS