The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
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> 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. |
#122
|
||||
|
||||
That didn't work either. I don't think the problem is the actual conditional though ... I just think that the plugin isn't accessing the profile information in order to apply it.
|
#123
|
|||
|
|||
thanks for the correct code!
|
#124
|
||||
|
||||
There is no possible way the code you quoted works... It starts of as VB3 condition with just: <if condition="..."> and ends with the VB4 conditional </vb:if>... so that code won't work in any version... In VB3 you don't use the "vb:" at all, in VB4 you need to use it every time.
|
#125
|
|||
|
|||
I am trying to insert a an unique image heard for each of main page, HOME, Forum, What's New etc. How would you do that with condition?
Fore example: If you are on the Home page include home heard image, If you are on the Forum page include Forum image, and so on. Please see attachments. |
#126
|
||||
|
||||
Quote:
Code:
<vb:if condition="THIS_SCRIPT == 'calendar'">Show this only on calendar.php</vb:if> So basically... Code:
<vb:if condition="THIS_SCRIPT == 'index'">Image 1</vb:if> <vb:if condition="THIS_SCRIPT == 'forumdisplay'">Index 2</vb:if> --------------- Added [DATE]1285699615[/DATE] at [TIME]1285699615[/TIME] --------------- NEW POST HERE-- Stupid Auto Merge FYI This is a useful conditional if you want to hide the Facebook Like button in forums that aren't open to the public. If someone "Likes" a thread in a private forum people will be greeted with a no-permission "have to register" message which usually people will just get annoyed at rather than register. In fact if it's a private forum they may not even have access even after registering. To use this conditional edit the SHOWTHREAD template... find the code: Code:
<vb:if condition="$show['fb_likebutton']"> Code:
<vb:if condition="$show['fb_likebutton'] AND !in_array($threadinfo['forumid'], array(3,4,5))"> |
#127
|
||||
|
||||
any "if condition" to show text/html only once on a certain place?
I am using CMS on my live site, and it has 1x2 content column on front page. I tried to place text/html/adsense code after first column however it always displays the text on all columns. Any recommendations for that? |
#128
|
|||
|
|||
<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">Show this to user group 1, 2, and 3</vb:if>
what if I move someone to a group and then i wanted to show an image in the postbit for everyone to see IF that member is in a certain group. |
#129
|
||||
|
||||
In postbit you can use this to see if a member is in usergroup x.
Code:
<vb:if condition="$post['usergroupid'] == x"> -stuff- </vb:if> |
#130
|
||||
|
||||
<font color="DarkGreen">Great work i love it
</font> |
#131
|
||||
|
||||
I have tried this code below in my footer ad location and it display in all my usergroups. Is there something wrong with the code?
Code:
<vb:if condition="is_member_of($bbuserinfo, 1,2,3)">Show this to user group 1, 2, and 3</vb:if> |
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|