View Full Version : All Vb <if> conditions
mihai11
11-20-2006, 02:35 PM
Hi,
I would like to learn more about the conditions that I can use in VB templates. For example, I am aware of the following tests:
<if condition="$show['guest']">You're a guest!</if>
<if condition="$show['member']">You're a member, not a guest</if>
How can I find out what other tests I can perform with the variable "$show" ?
For example, can I use it to find out if the user browsing the page is an administrator ?
If the answer is "yes", then how did you knew how to build the test condition ?
Regards,
Razvan
Adrian Schneider
11-20-2006, 04:12 PM
<if condition="is_member_of($vbulletin->userinfo, 6)">This will show to admins</if>You can replace the 6 with any usergroupid, or check for a few at a time (5, 6, 7) to see if they are in any of them. It's parsed as PHP code so the possible conditions are nearly infinite.
mihai11
11-20-2006, 09:19 PM
Where are these functions defined ? (show, is_member_of)
Can I get a list of these built-in functions ?
Regards,
Razvan
Adrian Schneider
11-20-2006, 09:36 PM
$show is a variable, and is_member_of() is a function.
Here is a list of some common conditions you can use,
http://www.vbulletinzone.com/t44
mihai11
11-22-2006, 04:36 PM
This is great resource !!! Thanks !!!
What about the variables, like $show ? Is there some VB documentation about what variables are available and where (in which templates) ?
gbechtel
12-15-2010, 01:14 AM
I want to be able to block ads by IP or a block of IP's. I don't want to move members into groups because some of the users I don't want to show ads to are not even members. The problem I am having is with users clicking on Google Ads that are on the same network, I don't want any issues with Google so I am trying to take care of the issue before I get the warning from them.
Is their a condition that does this, does anyone have a starting point that I could play around with and test?
Thanks.
JacquiiDesigns
12-15-2010, 01:21 AM
I want to be able to block ads by IP or a block of IP's. I don't want to move members into groups because some of the users I don't want to show ads to are not even members. The problem I am having is with users clicking on Google Ads that are on the same network, I don't want any issues with Google so I am trying to take care of the issue before I get the warning from them.
Is their a condition that does this, does anyone have a starting point that I could play around with and test?
Thanks.
You bumped a thread from 2006 o.O -- You may get a better response if you post your own thread. Also - what version of vBulletin are you using?
At anyrate - No - There is no condition for blocking IP address. A list of conditionals for vB 3.x can be found at http://tech6.com/f51/vbulletin-template-conditionals-list-t112/ -- I'm not familiar with vB4 conditionals - you might be able to find a list here or at http://vbulletin.com - use search :)
HTH,
Jacquii.
s.sami
08-17-2011, 04:38 PM
<if condition="is_member_of($vbulletin->bf_ugp_forumpermissions['canview'])"> is this possible ?
<if condition="is_member_of($vbulletin->bf_ugp_forumpermissions['canview'])"> is this possible ?
What you have there won't work. What are you trying to do?
s.sami
08-17-2011, 04:52 PM
i try if the user have permisson view category can see lastpost title on the forum statics but if No have permission (see you dont have permission)
i use this
<if condition="!in_array($bbuserinfo[usergroupid], array(5,6,9))">
<if condition="in_array($latestpost[forumid], array(43, 44, 45, 160, 161, 36, 37, 95, 146, 153, 38, 39, 40, 41, 94, 104))">
<a href="showthread.php?p=$latestpost[lastpostid]" class="text3"><b><font color="red">you dont have permisson view this title!</font><b></span>
<else />
<a href="showthread.php?p=$latestpost[lastpostid]" class="hak">$latestpost[title]</span>
</if>
bu as you know this is not useful..
What template do you want to put that in?
s.sami
08-17-2011, 04:59 PM
this is forum statics plug-in "changuondyu_latestpost_bit"
Hmm...I'm not sure what to tell you. It depends on what variables are available when the template is eval'd, and not only is that from a mod, but apparently that mod is no longer available.
s.sami
08-17-2011, 05:36 PM
if the user can view forumid x can see this thread title.. my mean is this..
BirdOPrey5
08-19-2011, 01:54 PM
What's stored in $vbulletin->bf_ugp_forumpermissions['canview']?
If it's just a 1 or 0 or true or false maybe all you need is:
<if condition="$vbulletin->bf_ugp_forumpermissions[canview]">
Unless I'm mistaken, $vbulletin->bf_ugp_forumpermissions[canview] is a mask for checking that forum permission, so you'd need the actual forum permission bits to '&' it with. Unfortunately I can't find the source for that mod so I don't know if it's available or what.
souperman
08-20-2011, 09:17 PM
You can use pretty much anything in the <if>
Here's a bit more complex ones,
<if condition="($variable1 == 1) AND ($variable2 = "sample string" || $variable3 != "sample")">
html here
</if>
s.sami
08-21-2011, 04:06 PM
this is not working.
<if condition="$vbulletin->bf_ugp_forumpermissions[canview]">
i need this php code for vb for forumhome_lastpostby template
if (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND $lastpostinfo['lastposter'] != $vbulletin->userinfo['username']))
s.sami
08-27-2011, 10:07 PM
<if condition="$bbuserinfo[forumpermissions][$forum[forumid]] & 36">
why cant i use this ?
--------------- Added 1314486659 at 1314486659 ---------------
i need if user have permissinon on this forumid can see this code
help please
souperman
08-28-2011, 05:09 AM
What are you trying to do? can you explain a bit clearer?
s.sami
08-28-2011, 05:47 AM
sure..
i use lastthreads plug-in on my forum
http://a1108.hizliresim.com/11/8/28/6019.png
i want if user have permission this forum categoriy can view last thread title if no have see you dont have permessin to see this thread title..
like functions_forumlist.php
if (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR (!($lastpostforumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) AND $lastpostinfo['lastposter'] != $vbulletin->userinfo['username']))
{
$forum['lastpostinfo'] = $vbphrase['private'];
}
else
{
$lastpostinfo['lastpostdate'] = vbdate($vbulletin->options['dateformat'], $lastpostinfo['lastpost'], 1);
$lastpostinfo['lastposttime'] = vbdate($vbulletin->options['timeformat'], $lastpostinfo['lastpost']);
$lastpostinfo['trimthread'] = fetch_trimmed_title(fetch_censored_text($lastposti nfo['lastthread']));
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.