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. |
#42
|
||||
|
||||
this is not work too with me
Code:
<vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>
|
#43
|
|||
|
|||
Yes well aren't I the ignorant one? Hahah
Do you know if there is any work around? |
#44
|
|||
|
|||
I have an idea.
I want to give someone control of their own thread. I figure that a good way to do that would be to duplicate the supermoderator group, calling it "threadModerator", then only display the "show admintools" dropdown IF the current user is both a threadAdmin AND is author of the current thread. In other words, if the threadmoderator group is "100," How can I then say If currently_logged_in_user is threadmoderator and If currently_logged_in_user = thread_starter then show admintools I figure its something close to: <vb:if condition="is_member_of($bbuserinfo, 100)"> <vb:if condition="is_author_of($thread)"> show admintools </vb:if> </vb:if> It has to be something close to this...though I dont know how to query the system to find out the author of a thread...nor do I know how to reference the "show admintools" function...but I figure I've reasoned this out and given enough effort that one of you...who are MUCH better programmers than I...is willing to help me (and anyone that wants to use the code, giving myself and the person who cleans this up the credit). How bout it people? Can someone help with this...? |
#45
|
|||
|
|||
What would the code be to only show on forumhome?
|
#46
|
|||
|
|||
not work for me
|
#47
|
|||
|
|||
Can any one tell me what i would have to use to get a sign to come up only when a thread is closed ?
So basically if a thread is closed i want a certain peace of HTML to show up |
#48
|
|||
|
|||
i need some help with the variables below to work with certian group and also an option not to show to certian groups can anyone help
so far i have this Code:
<vb:if condition="is_member_of($bbuserinfo, {vb:raw vboptions.wmf_grp_perm})"> <vb:if condition="$vboptions['paypal_enable']"> <vb:else /> {vb:raw vboptions.wmf_closedreason} </vb:if> i hope i got the code in the correct order so far i wanna add {vb:raw vboptions.wmf_grp_noperm} but not sure where to put it and if i need to add anything else to my exist code after the one i want inserted |
#49
|
||||
|
||||
lol Wish I would have saw this before. Oh well, I figured it out :P Thanks for this though!
|
#50
|
|||
|
|||
Quote:
|
#51
|
|||
|
|||
Try this;
Code:
<vb:if condition="in_array($foruminfo[forumid], array(x,y,z))">
code here!
</vb:if>
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|