View Full Version : If then statements.
4x4 Mecca
02-28-2007, 02:15 AM
If this is in the wrong forum, I apologize in advance.
I was on a site ColoradoK5 you can see the hack here.(http://coloradok5.com/forums/showthread.php?t=200375). He has a hack he made that allows him to specify users to receive little icons on the bottom of their post bit.
I asked him how he did it, and he just told me he made some sort of if/then code where if userid = 123 then post the graphic.
Can someone here teach me how I would write something like that?
Thanks.
Princeton
02-28-2007, 02:22 AM
I do not see any "little icons" .. perhaps you have to be logged in :confused:
upload a screenshot
Reeve of shinra
02-28-2007, 02:24 AM
If you want to use this with a lot of users, create a new profile field and note the profile id # and add this code into your postbit template (mine is 19).
<!-- begin img -->
<br />
<div>
<if condition="$post['field19'] != ''">
<img src="$post[field19]" />
</if>
</div>
<br />
<!-- end img-->
There is more on conditionals here:
http://www.vbulletin.com/docs/html/main/template_conditionals
4x4 Mecca
02-28-2007, 02:29 AM
I have the code, I can't delete my post, so thanks for reading.
<if condition="in_array($post[userid], array(1,2))">
<img src="image.gif" alt="MouseOver" border="0" />
</if>
If you want to use this with a lot of users, create a new profile field and note the profile id # and add this code into your postbit template (mine is 19).
<!-- begin img -->
<br />
<div>
<if condition="$post['field19'] != ''">
<img src="$post[field19]" />
</if>
</div>
<br />
<!-- end img-->
There is more on conditionals here:
http://www.vbulletin.com/docs/html/main/template_conditionals
Thanks! That sounds a little more in depth.
Reeve of shinra
02-28-2007, 02:34 AM
Yeah, the example you posted is better if you want to give certain users the same image. Mine is if you want to give users thier own image. Different purposes.
Princeton
02-28-2007, 02:50 AM
you can also use USER RANKS
http://www.vbulletin.com/docs/html/user_ranks_example_1
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.