vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=231525

vB4 Template Conditionals List
by BBR-APBT
29 Dec 2009 05:01

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:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show only guest:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show specific user groups :

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show one member:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show every one but one member:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show only moderators of any forum:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Show Moderator of one forum: Remember to change x

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show Moderator of current forum:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show in one forum: Remember to change x

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show is every forum but one: Remember to change x

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show in several forums:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Show in only one file: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you want it to show in.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


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.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


If $customvar is set:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


If $customvar equals:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


If $customvar does not equal:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


vBulletin else statement:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


vBulletin else if statement:

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


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.

nubian 29 Dec 2009 08:30

subscribed!

Antyrael 29 Dec 2009 15:34

Thanks for this list! :)

Asterix_ita 30 Dec 2009 09:26

Excuse me a question, to the undersigned not work conditions with $forum[forumid] is the variable that changed?

thanks


PS example

<vb:if condition="!in_array($forum[forumid], array(18,19))">

text text

</vb:if>

Hornstar 31 Dec 2009 06:31

very nice, this has helped me understand all the conditionals much better.

Hasanudin 31 Dec 2009 11:13

subscribe too..

nice, thx u

nymyth 31 Dec 2009 14:10

this is so clutch...nice

rbc 31 Dec 2009 20:37

super, thanks & happy new yeahr ;)

baghdad4ever 01 Jan 2010 08:38

thank you very much

ragtek 01 Jan 2010 10:23

Quote:

Originally Posted by Asterix_ita (Post 1942260)
Excuse me a question, to the undersigned not work conditions with $forum[forumid] is the variable that changed?

thanks


PS example

<vb:if condition="!in_array($forum[forumid], array(18,19))">

text text

</vb:if>

$forum[forumid] have to be registered to the template.
There's an other article here.

Asterix_ita 01 Jan 2010 10:37

Quote:

Originally Posted by ragtek (Post 1943831)
$forum[forumid] have to be registered to the template.
There's an other article here.

thanks, I must enter the new logic. Happy New Year

MikeWarner 02 Jan 2010 12:27

Hi - thanks for this post, however, can you provide conditionals for CMS sections please?

BBR-APBT 02 Jan 2010 16:19

Quote:

Originally Posted by MikeWarner (Post 1944821)
Hi - thanks for this post, however, can you provide conditionals for CMS sections please?

I don't have the CMS and most of these will work for the CMS.

You may have to preregister the var.

abumohamed 05 Jan 2010 19:44

Thanks

hochun 06 Jan 2010 00:14

Hello everybody! I have one problem with porting one of my products to VB4.

I have the setting for a product called vfsms_can_stick_by_sms - it's comma separated list of forum-sections where this product is turned on.

In this product I have the following plugin:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And in template SHOWTHREAD I have next conditional:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I have few problems:

1. variable $vfsms_allowed4sticky_forums can be accessed only as a {vb:raw vfsms_allowed4sticky_forums} and I can not put it to the condition
2. variable $forumid is not accessible anymore

Please, somebody, help me!

--------------- Added 06 Jan 2010 at 00:28 ---------------

but everything is ok if I pass variable directly from the showthread.php:



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

and in template also replace $forumid on $thread[forumid]

This is absolutely wrong way of doing the thing I need, pls tell me how to do it without changes in showthread.php!


All times are GMT. The time now is 12:12.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.