Go Back   vBulletin Setup > vBulletinSetup Information > Troubleshooting vBulletin Problems

Reply 
 
LinkBack Thread Tools Display Modes
Old 01-19-2010, 12:54 PM   #1
vBulletin Owner
 
Join Date: Jan 2010
Posts: 21
BBR-APBT will become famous soon enough
vB4 Template Conditionals List

I put this together because it seems lots of people are having problems with the new syntax for conditionals.

First off remember you can not use {vb:raw var} in template conditionals.

Show only members:
Code:
<vb:if condition="$show['member']">Show this to members only</vb:if>

Show only guest:
Code:
<vb:if condition="$show['guest']">Show this to guest only</vb:if>

Show specific user groups :
Code:
<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">Show this to user group 1, 2, and 3</vb:if>

Show one member:
Code:
<vb:if condition="$bbuserinfo['userid'] == 318713">Show this only to the member with the user id of 318713</vb:if>

Show every one but one member:
Code:
<vb:if condition="$bbuserinfo['userid'] != 318713">Show this to every one but the member with the user id of 318713</vb:if>

Show only moderators of any forum:
Code:
<vb:if condition="can_moderate()">Show this to all moderators</vb:if>
Show Moderator of one forum: Remember to change x
Code:
<vb:if condition="can_moderate($forum['x])">Show this if moderator is moderator of the forum with the id of x</vb:if>

Show Moderator of current forum:
Code:
<vb:if condition="can_moderate($forum['forumid'])">Show this to the moderator of the current forum</vb:if>

Show in one forum: Remember to change x
Code:
<vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>

Show is every forum but one: Remember to change x
Code:
<vb:if condition="$forum[forumid] != x">Show this if forum id is not x</vb:if>

Show in several forums:
Code:
<vb:if condition="in_array($forum['forumid'], array(1,2,3))">Show this to forum 1, 2 and 3</vb:if>

Show in only one file: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you want it to show in.
Code:
<vb:if condition="THIS_SCRIPT == 'calendar'">Show this only on calendar.php</vb:if>

Show in every file but one: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you do not want it to show in.
Code:
<vb:if condition="THIS_SCRIPT != 'calendar'">Show this only on calendar.php</vb:if>

If $customvar is set:
Code:
<vb:if condition="$customvar">Show this if $customvar is set</vb:if>

If $customvar equals:
Code:
<vb:if condition="$customvar == blah">Show this if $customvar equals blah</vb:if>

If $customvar does not equal:
Code:
<vb:if condition="$customvar != blah">Show this if $customvar does not equal blah</vb:if>

vBulletin else statement:
Code:
<vb:if condition="$show['guest']">
Show this to only guest.
<vb:else />
Show this to all registered users
</vb:if>

vBulletin else if statement:
Code:
<vb:if condition="$show['guest']">
Show this to only guest.

<vb:elseif condition="is_member_of($bbuserinfo, 5,6)" />
Show this to user group 5 and 6 which is  mods and admins

<vb:else />
Show this to all registered users

</vb:if>

This is all that I can think of right now off the top of my head.
Please feel free to add any I forgot and I will add them to this list and give you credit.
BBR-APBT is offline   Reply With Quote

Advertisement [Remove Advertisement]

Old 01-19-2010, 01:07 PM   #2
Supporters
vBulletin Owner
 
KevinL's Avatar
 
Join Date: Apr 2009
Location: Boston
Posts: 455
KevinL is a glorious beacon of lightKevinL is a glorious beacon of lightKevinL is a glorious beacon of lightKevinL is a glorious beacon of light
Send a message via Skype™ to KevinL
Re: vB4 Template Conditionals List

I am not using (and probably never will lol) vb4, but this is pretty sweet!

Thanks!
KevinL is offline   Reply With Quote
Old 02-23-2010, 10:09 AM   #3
vBulletin Owner
 
Join Date: Mar 2009
Posts: 19
Henkcod2 will become famous soon enough
Re: vB4 Template Conditionals List

Great Thanks =D
Henkcod2 is offline   Reply With Quote
Reply 
vBulletin Setup > vBulletinSetup Information > Troubleshooting vBulletin Problems

Thread 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
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
directory list divengrabber vBulletin SEO Tips and SEO Questions 11 03-18-2010 09:35 PM
vBulletin Template Conditionals List Brandon Sheley Troubleshooting vBulletin Problems 76 01-27-2010 01:21 PM
using the ignore list Caddyman Community Forum Management 9 09-26-2008 07:14 PM
List of domains you own Rocket 442 General Discussion 11 10-15-2007 03:36 PM
Members List joh Troubleshooting vBulletin Problems 2 03-30-2007 03:03 PM


All times are GMT -8. The time now is 03:23 AM.