View Full Version : vB4 Template Conditionals List
BirdOPrey5
07-01-2011, 05:25 PM
How can I insert a banner in the first post of the every pages of the thread ?
Open postbit template...
find {vb:raw post.message}
Either directly above it or below it add this code:
<vb:if condition="$post['isfirstshown']">
BANNER CODE HERE
</vb:if>
baghdad4ever
07-01-2011, 07:23 PM
Open postbit template...
find {vb:raw post.message}
Either directly above it or below it add this code:
<vb:if condition="$post['isfirstshown']">
BANNER CODE HERE
</vb:if>
thanks alot
it is worked perfectly:D
is there any way to put the banner between the content of thread?
ie: among words of post not before nor after
thanks again
BirdOPrey5
07-01-2011, 08:39 PM
Not with a template conditional... that would require some custom coding beyond the realm of this article.
baghdad4ever
07-01-2011, 09:09 PM
Not with a template conditional... that would require some custom coding beyond the realm of this article.
thanks alot for your kind reply
flbutterflyz
07-07-2011, 07:34 PM
Hi,
I created a profile field that I'd like each usergroup to view but only want 3 usergroups to use. How do I go about that in postbit legacy? Here's what I have so far:
<vb:if condition="$post[field27] != ''"><img src="images/favthings/{vb:raw post.field27}.png" title="Favorite Things" align="left" border="0" /></vb:if>
HMBeaty
07-07-2011, 07:37 PM
Hi,
I created a profile field that I'd like each usergroup to view but only want 3 usergroups to use. How do I go about that in postbit legacy? Here's what I have so far:
<vb:if condition="$post[field27] != ''"><img src="images/favthings/{vb:raw post.field27}.png" title="Favorite Things" align="left" border="0" /></vb:if>
<vb:if condition="is_member_of($bbuserinfo, 1,2,3) AND $post[field27] != ''"><img src="images/favthings/{vb:raw post.field27}.png" title="Favorite Things" align="left" border="0" /></vb:if>
And change "1,2,3" to the 3 usergroup id's you wish to show the code to
flbutterflyz
07-08-2011, 12:10 AM
Thank you SO much!! :)
HMBeaty
07-08-2011, 12:31 AM
Thank you SO much!! :)
No problem :)
flbutterflyz
07-26-2011, 05:23 PM
^^Regarding the same code above, is there a way to let the image show to everyone but only usable for certain usergroups? Meaning the image will only be active in 4 usergroups' postbit but everyone can view the image.
Not sure if I'm explaining it well...
mrderanged
08-04-2011, 05:05 PM
I'm trying to make the tab to collapse the sidebar only visible to paid members, I want everyone else to be unable to collapse it.
Would this be the correct edit to the forumhome template?
<a id="sidebar_button_link" href="#">
<vb:if condition="is_member_of($bbuserinfo, 9,10,11)">
<vb:if condition="$show['sidebarposition'] == 'left'">
<img id="sidebar_button" src="{vb:stylevar imgdir_misc}/tab-collapsed-left.png" alt="" />
<vb:else />
<img id="sidebar_button" src="{vb:stylevar imgdir_misc}/tab-collapsed.png" alt="" />
</vb:if>
</vb:if>
</a>
thanks in advance
Divvy
08-13-2011, 09:01 AM
Hello guys,
Maybe someone can help me...
I have this code:
$template_hook['postbit_userinfo_right_after_posts'] .= '<div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div>';
That shows a link at postbit with all topics from the user at a two specific forums.
I need that:
- the link only shows when the user have threads at least in one of that two forums.
- If not, the link doesn't appear.
Is there any syntax for this?
Or else, I had another idea...
The links only appear If the user belongs to a specific group.
BirdOPrey5
08-13-2011, 09:45 AM
Hello guys,
Maybe someone can help me...
I have this code:
$template_hook['postbit_userinfo_right_after_posts'] .= '<div style="clear:both;" class="left"><a target="_blank" href="'.$mylink.''.$usernumber.'">'.$mylinktitle.'</a></div>';
That shows a link at postbit with all topics from the user at a two specific forums.
I need that:
- the link only shows when the user have threads at least in one of that two forums.
- If not, the link doesn't appear.
Is there any syntax for this?
Or else, I had another idea...
The links only appear If the user belongs to a specific group.
You're posting PHP code- that has nothing to do with template conditionals. I suggest asking in the VB4 Programming forum, it's not part of this discussion.
8thos
08-25-2011, 01:03 AM
How do you use conditionals to hide a thread by use of it's thread id or a combination of thread ids?
Say for instance, I have a thread in a forum that I don't want guests to view but I want guests to be able to view the whole subforum and it's other threads.
Dirt Bike Addict
09-12-2011, 02:26 PM
Is this the most efficient way to do a multi-THIS_SCRIPT if conditional?
<vb:if condition="in_array(THIS_SCRIPT, array('search' , 'calendar' , 'usercp' , 'online' , 'faq' , 'album' , 'profile' , 'member' , 'misc' , 'subscription' , 'private' , 'showgroups'))">
Show on the above pages/scripts
<vb:else />
Show on all other pages/scripts
</vb:if>
BirdOPrey5
09-12-2011, 04:15 PM
^yes, that is how I would do it.
Dirt Bike Addict
09-12-2011, 04:40 PM
^yes, that is how I would do it.
Awesome, thanks Joe!
It might not be a bad idea to have that added to the article, it took me awhile to figure out how to do. :mad:
VinavB
09-13-2011, 07:20 AM
any condition for article in CMS ???
Budget101
11-21-2011, 03:21 PM
What is the correct syntax for a conditional that is a member with at least 'X' posts/threads made in the last 30 days?
Any ideas? TIA!
BirdOPrey5
11-21-2011, 09:02 PM
You cannot use a template conditional for posts within x days, you would need a plugin to calculate this value.
Loversama
01-31-2012, 02:47 PM
^^Regarding the same code above, is there a way to let the image show to everyone but only usable for certain usergroups? Meaning the image will only be active in 4 usergroups' postbit but everyone can view the image.
Not sure if I'm explaining it well...
<vb:if condition="$post[usergroupid]==17">
;D
AshMagic
02-07-2012, 02:35 PM
What is the variable for displaying the total amount of registered members on vBulletin 4?
inigo
02-10-2012, 05:45 AM
I would like to insert some ad code in the CMS home, between the articles preview, but I would like to know the conditional to show this ads only after the preview article position I like.
I have the 1+2 colums selected, so i wouuld like to show,
1 article_preview,
AD CODE
2 article preview 3 article preview
4article preview 5 article preview
AD CODE
6 article preview 7 article preview
8article preview 9 article preview
AD CODE
At the moment I know to add the AD CODE at the end of all the previews (Template article_preview).
Any help of what conditional and in which template have I to use?
Thanks!
MGP_Tech
03-25-2012, 04:43 PM
What conditional would I use for my postbit to only show the Blog Entries if the user has posted a blog?
MGP_Tech
03-26-2012, 07:29 PM
What conditional would I use for my postbit to only show the Blog Entries if the user has posted a blog?
Found it <vb:if condition="$post['entries'] > 0"></vb:if>
egysc
03-27-2012, 03:59 AM
I wonder what is the if condition for the mobile phones (any type smart or not ) that can be used ?
sinucello
05-05-2012, 08:45 PM
Hi,
thanks for the great posts so far, they helped me a lot with integrating different advertising-codes for different pages (IVW) into the header template. I still need 2 conditions:
1. a conditional for announcements
to render something into the header template in all announcements
2. a conditional that effects all sub-forum of a parent forum or category
as I don`t want to use an array with all the forum IDs because the list of IDs is very long and
might change from time to time
would be great if someone has a solution for those 2.
thank you - all the best,
Sacha
stuartn
05-06-2012, 08:36 PM
In user profile options I want to make and option only viewable to be accessed by a certain usergroup. How would you achieve this ?
--------------- Added 1336340365 at 1336340365 ---------------
Hi,
thanks for the great posts so far, they helped me a lot with integrating different advertising-codes for different pages (IVW) into the header template. I still need 2 conditions:
1. a conditional for announcements
to render something into the header template in all announcements
2. a conditional that effects all sub-forum of a parent forum or category
as I don`t want to use an array with all the forum IDs because the list of IDs is very long and
might change from time to time
would be great if someone has a solution for those 2.
thank you - all the best,
Sacha
This still works for me
https://vborg.vbsupport.ru/showthread.php?t=132716
Then in the html box insert what you need per forum.
nrms?
05-21-2012, 02:16 PM
Another conditional in my case I'm using to make improvements in the sharing of urls in topics:
<vb:if condition="$bookmarksites"> show only if showing bookmarks </vb:if>
Yogesh Sarkar
06-02-2012, 05:17 PM
If there a conditional that can be used for CMS home page, which would not have an bearing on rest of the CMS pages?
Gripi
06-06-2012, 07:53 AM
hi..
i try to put this in the forumdisplay template, but no luck, anyone could help:
<vb:if condition="!in_array($forum['forumid'], array(1, 2))">not show to forumid 1 and 2</vb:if>
still showing to all forum ID, and i read from the 1st page this thread, lots of people got the same problem with me.
BirdOPrey5
06-06-2012, 09:26 AM
Try using-
<vb:if condition="!in_array($foruminfo['forumid'], array(1, 2))">not show to forumid 1 and 2</vb:if>
Also, I've never seen a VB forum with a usable forumid 1. Usually 2 is the first usable forumid. 1 is the main category which doesn't work in such a conditional.
Gripi
06-06-2012, 02:09 PM
ok..
one more thing..
how to make condition "show only to member that already had >= 50 post count" ?
<vb:if condition="$post['postcount'] >= 50"> now show to under 50 postcount</vb:if>
the command above wont work.
thanks
ok..
one more thing..
how to make condition "show only to member that already had >= 50 post count" ?
<vb:if condition="$post['postcount'] >= 50"> now show to under 50 postcount</vb:if>
the command above wont work.
thanks
Try:
<vb:if condition="$userinfo['postcount'] >= 50"> now show to under 50 postcount</vb:if>
Gripi
06-06-2012, 02:29 PM
Try:
<vb:if condition="$userinfo['postcount'] >= 50"> now show to under 50 postcount</vb:if>
hi..
not working too.. the command not show to all member.. not just member with under 50 post count
BirdOPrey5
06-06-2012, 03:07 PM
The variable would be $bbuserinfo['posts'], not $userinfo['postcount'] in forumdisplay.
Gripi
06-06-2012, 03:56 PM
The variable would be $bbuserinfo['postcount'], not $userinfo['postcount'] in forumdisplay.
i want to put the command inside the "postbit_legacy", and the above command wont work too.
--------------- Added 1339003487 at 1339003487 ---------------
Try using-
<vb:if condition="!in_array($foruminfo['forumid'], array(1, 2))">not show to forumid 1 and 2</vb:if>
Also, I've never seen a VB forum with a usable forumid 1. Usually 2 is the first usable forumid. 1 is the main category which doesn't work in such a conditional.
just try this, not working in "ad_global_below_navbar" template too.
BirdOPrey5
06-06-2012, 04:48 PM
Sorry the post count for a user is $bbuserinfo['posts']
for ad_global_below_navbar try $GLOBALS['forumid']
Gripi
06-07-2012, 03:40 AM
thanks, globals works :)
stuartn
06-07-2012, 03:03 PM
<vb:if condition="in_array($foruminfo[forumid], array(166,113,110,109,108))"></vb:if>
Works fine in mine...
--------------- Added 1339085022 at 1339085022 ---------------
Obviously the ! addition to the in_array has the reversed effect
fanhockeycoach
06-08-2012, 09:19 PM
HELP
I am trying this code but its not working.
<vb:if condition="$forum=59">{vb:raw show.vbshout_instance3}</vb:if>
I want this shout box to show only in forum 59 but it shows up in every forum.
What am i doing wrong? Does this go in FORUMDISPLAY?
HELP
I am trying this code but its not working.
<vb:if condition="$forum=59">{vb:raw show.vbshout_instance3}</vb:if>
I want this shout box to show only in forum 59 but it shows up in every forum.
What am i doing wrong? Does this go in FORUMDISPLAY?
Your syntax is incorrect. Please reread the first post.
fanhockeycoach
06-09-2012, 06:01 PM
i did reread and still not sure why I can't have this show up only in a certain forum
I know you need a double '=', like:
<vb:if condition="$forum==59">{vb:raw show.vbshout_instance3}</vb:if>
but I'm not sure if $forum is what you should be using or not.
fanhockeycoach
06-09-2012, 09:06 PM
I know you need a double '=', like:
<vb:if condition="$forum==59">{vb:raw show.vbshout_instance3}</vb:if>
but I'm not sure if $forum is what you should be using or not.
YOU ROCK
it was forum info
Ok now I think I got it to work
<vb:if condition="$foruminfo['forumid']==X">{vb:raw show.vbshout_instanceY}</vb:if>
X - forum ID #
Y - instance #
ddshosting
07-02-2012, 07:46 PM
Has anyone used a template conditional statement in the header for the URL or a regexpression of using the URL? I need to spit out differnent elements of the header depending on what section visitors are viewing.
Thanks.
BirdOPrey5
07-02-2012, 10:46 PM
I don't see how you can use a regex in a template conditional, there are no regex functions allowed in templates...
The very short list of allowed functions is here:
https://www.vbulletin.com/docs/html/functions_in_conditionals
So you're going to need a plugin to do the back end of whatever it is you need to do.
In a plugin this should give you the current http path (minus the bburl):
$vbulletin->input->fetch_relpath();
stuartn
07-18-2012, 05:39 PM
using this in forum display and it doesn't appear to work any longer in 4.2 pl2 - any ideas and yes it has a closing if statement...
<vb:if condition="is_member_of($bbuserinfo, 1,2,3,4)">
qpurser
07-19-2012, 12:24 PM
Hope somebody can help me with the following:
I have a forum called classifieds (forum id10)
This forum has 2 prefixes (only members and open to all)
Now I only want to show in this forum the ones with the prefix "only members" to the user group called "members" (user group id 9)
I guess I can do this with a conditional but not sure how to.
Also where would I put the conditional?
Thanks
Michael
chikuru
08-02-2012, 06:01 PM
How can restrict signature on certain forum ID?
Example:
In forumID 2, How can I make only admin and mod's signature will be enabled, other usergroup's signature wont display?
Thanks
BirdOPrey5
08-02-2012, 07:37 PM
Look in the postbit or postbit_legacy template for the signature code:
There is already a conditional you can edit:
<vb:if condition="$post['signature']">
To allow the signatures on all forums except forum 2
<vb:if condition="$post['signature'] AND $thread['forumid'] != 2">
To allow the signatures on all forums except forum 2, but OK in forum 2 is staff
<vb:if condition="$post['signature'] AND ($thread['forumid'] != 2 OR is_member_of($post, 5,6,7))">
I haven't tested this but try it. If not it may need to be:
<vb:if condition="$post['signature'] AND ($thread['forumid'] != 2 OR in_array($post['usergroupid'], array(5,6,7)))">
chikuru
08-03-2012, 06:17 AM
thanks, its working now...
BirdOPrey5
08-03-2012, 01:30 PM
Well you basically have
condition="XXX"
Where XXX is something like:
$post['signature'] == 'Value'
or such.
You just need to add additional statements with AND or OR depending on what you want.
Use parentheses to keep the logic correct/easy to follow
condition="(XXX) OR ((YYY) AND (ZZZ))"
For example... if XXX is true OR if YYY and ZZZ are true regardless of the value of XXX.
Budget101
08-24-2012, 03:35 PM
I would like to add an "if condition" based on style id, but am having difficulty with the correct syntax to use...
For example - if vbDefault style id =2 and NewGreat Style id = 4
I would like to be able to add an if condition to the widget templates- if browsing with vb default style id #2 - Display the widget; otherwise if browsing with NewGreat Style Id #4 - (DO Not Display the widget!)
Anyone willing to offer some assistance? Thanks so much, greatly appreciated!
<vb:if condition="$styleid=2">
Display widget
<vb:else />
Do not Display widget
</vb:else>
BirdOPrey5
08-26-2012, 02:16 PM
<vb:if condition="$bbuserinfo['styleid'] == 2">
tareqbd
08-27-2012, 04:36 AM
<vb:if condition="in_array($forum['forumid'], array(1,2,3))">Show this to forum 1, 2 and 3</vb:if>
Not working in vbulleting 4.2.0
Anybody help please.
BirdOPrey5
08-27-2012, 11:12 AM
Not working in vbulleting 4.2.0
Anybody help please.
It works but only on some pages... use
$GLOBALS['fourmid']
instead of
$forums['forumid']
to work on all pages (forums and threads)
ChiNa
08-30-2012, 05:13 PM
Thank you so much, one of the greatest so far in the articles area,,,
dougdirac
09-05-2012, 04:57 AM
Is there a conditional for a forum and all its sub-forums?
vbxmod
09-07-2012, 07:08 PM
Is it possible to add conditional registration usergroup submission. If the user select group x then the user will automatically added in that user group or it will go to default registration group.
Thank you for your attention.
Draffi
09-09-2012, 12:24 AM
@:BBR-APBT
Thank you!
BirdOPrey5
09-11-2012, 11:18 AM
Is it possible to add conditional registration usergroup submission. If the user select group x then the user will automatically added in that user group or it will go to default registration group.
Thank you for your attention.
No, not possible via template conditionals.
Stefan118
09-21-2012, 07:20 PM
Not working in vbulleting 4.2.0
Anybody help please.
Use this:
<vb:if condition="in_array($GLOBALS['forumid'], array(1,2,3,))">Show this to forum 1, 2 and 3</vb:if>
instead of this:
<vb:if condition="in_array($forum['forumid'], array(1,2,3))">Show this to forum 1, 2 and 3</vb:if>
Edit: Ok, next time i will read first, and post later :)
tareqbd
09-22-2012, 02:23 PM
Use this:
<vb:if condition="in_array($GLOBALS['forumid'], array(1,2,3,))">Show this to forum 1, 2 and 3</vb:if>
instead of this:
<vb:if condition="in_array($forum['forumid'], array(1,2,3))">Show this to forum 1, 2 and 3</vb:if>
Edit: Ok, next time i will read first, and post later :)
Worked with BOP5's suggestion. same output from you too.
Thank you both of you.
Can anyone tell me how to do this...
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>
...but want to do it to my VBadvance Portal page which is index.php but on my domain root, not the forum root.
dougdirac
09-26-2012, 09:10 PM
Can anyone tell me how to do this...
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>
...but want to do it to my VBadvance Portal page which is index.php but on my domain root, not the forum root.
I think it's the same. Just find out what index.php is setting THIS_SCRIPT equal to.
Wonderful.. adv_index ...thankyou!
chikuru
10-01-2012, 04:36 PM
whats the conditional for this:
show this in all pages except in showthread of forum 1 and 2
the code will be placed on "below navbar banner"
BirdOPrey5
10-02-2012, 08:48 PM
hmmmm... try...
<vb:if condition="THIS_SCRIPT != 'showthread' OR !in_array($GLOBALS['forumid'], array(1, 2))">
code here
</vb:if>
That will show on any page NOT a showthread page, or if it is a showthread page, as long as it's not forum 1 or forum 2.
jluerken
10-03-2012, 12:23 PM
How does the template conditional need to look like if I want a text to appear if the forum is closed?
SHOW NOT abc if board is closed, ELSE show def...
Budget101
10-03-2012, 04:11 PM
<vb:if condition="$bbuserinfo['styleid'] == 2">
Thank you so very much!!
Lynne
10-03-2012, 04:38 PM
How does the template conditional need to look like if I want a text to appear if the forum is closed?
SHOW NOT abc if board is closed, ELSE show def...
What do you mean the "forum is closed"? Do you mean closed for posting or what? If the whole board is closed (as you state in your next line), nobody will be able to see the forum pages anyway.
TheSupportForum
10-04-2012, 09:12 AM
How does the template conditional need to look like if I want a text to appear if the forum is closed?
SHOW NOT abc if board is closed, ELSE show def...
there is a way to turn of a created page and have a custom message show if you turn the page off
you will need to do this in the php file
example would be...
// ###### YOUR CUSTOM CODE GOES HERE #####
if (!$vbulletin->options['mymod_active'])
{
eval(standard_error($vbulletin->options['mymod_closedreason']));
}
as Lynne said, if the board is off then they will see the off message from
Reason For Turning Forum Off in Admincp
jluerken
10-05-2012, 05:28 AM
How does the template conditional need to look like if I want a text to appear if the forum is closed?
SHOW NOT abc if board is closed, ELSE show def...
anyone?
BirdOPrey5
10-05-2012, 05:59 PM
anyone?
Maybe..
<vb:if condition="$vboptions['bbactive']">
FORUM ACTIVE CODE
<vb:else />
FORUM OFF CODE
</vb:if>
TheSupportForum
10-05-2012, 10:34 PM
Maybe..
<vb:if condition="$vboptions['bbactive']">
FORUM ACTIVE CODE
<vb:else />
FORUM OFF CODE
</vb:if>
thats vb default, the <vb:else /> is already handled in admincp
as $vboptions['bbclosedreason']
Big-K
11-01-2012, 10:15 AM
Folks, Is there a conditional for member of infraction groups?
I want to show specific avatars for infraction groups. I tried the following
<vb:if condition="$bbuserinfo['infractiongroupid'] ==1" />
also tried
<vb:if condition="is_member_of($infractiongroupid, 1)" />
RedTurtle
11-04-2012, 06:18 PM
Folks, Is there a conditional for member of infraction groups?
I want to show specific avatars for infraction groups. I tried the following
<vb:if condition="$bbuserinfo['infractiongroupid'] ==1" />
also tried
<vb:if condition="is_member_of($infractiongroupid, 1)" />
I'd also like to know if this is possible, but how to do it on a plugin also. It'd be great if I could have some code execute if the user had any active infractions.
Dax IX
11-25-2012, 01:06 AM
I'm trying to get link forum links to open in a new window or tab, so here's what I have in forumhome_forumbit_level2_nopost
This is the code for the forum title link, and I've added a vb:if condition:
<h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle"<vb:if condition="in_array($forum['forumid'], array(22))"> target="_blank"</vb:if>>{vb:raw .title}</a></h2>
.
vB is telling me I have a malformed conditional and the code is not working, but damned if I can figure out why.
Lynne
11-25-2012, 01:50 AM
I'm trying to get link forum links to open in a new window or tab, so here's what I have in forumhome_forumbit_level2_nopost
This is the code for the forum title link, and I've added a vb:if condition:
<h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle"<vb:if condition="in_array($forum['forumid'], array(22))"> target="_blank"</vb:if>>{vb:raw .title}</a></h2>
.
vB is telling me I have a malformed conditional and the code is not working, but damned if I can figure out why.
You need to tell us *exactly* where you are adding this so we may try it ourselves and see what is going on.
Dax IX
11-25-2012, 02:20 AM
I'm sorry, I thought it was pretty obvious. It's within the forum title link and the conditional I added is the only one in the statement, but here's my whole code for forumhome_forumbit_level2_nopost
<li class="forumbit_nopost {vb:raw forum.statusicon} L2" id="cat{vb:raw forum.forumid}">
<div class="forumrow table"><div class="foruminfo td">
<img src="{vb:stylevar imgdir_statusicon}/category_forum_{vb:raw forum.statusicon}.png" class="forumicon" id="forum_statusicon_{vb:raw forum.forumid}" alt="" />
<div class="forumdata">
<div class="datacontainer">
<h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle"<vb:if condition="in_array($forum['forumid'], array(22,24))"> target="_blank"</vb:if>>{vb:raw .title}</a></h2>
<vb:if condition="$show['forumdescription']"><p class="forumdescription">{vb:raw forum.description}</p></vb:if>
<vb:if condition="!$show['collapsable_forums']"><a href="javascript://" class="collapsegadget"></a></vb:if>
<vb:if condition="$show['subforums']">
{vb:raw forum.subforums}
</vb:if>
</div>
</div>
</div></div>
<vb:if condition="$childforumbits">
<ol id="c_cat{vb:raw forum.forumid}" class="childforum">
{vb:raw childforumbits}
</ol>
</vb:if>
</li>Thanks! :)
--------------- Added 24 Nov 2012 at 23:09 ---------------
The conditional I added was this:
<vb:if condition="in_array($forum['forumid'], array(22,24))"> target="_blank"</vb:if>
BirdOPrey5
11-25-2012, 01:06 PM
Not that it should make a difference but did you try putting spaces outside the conditional?
"forumtitle" <vb:if condition="in_array($forum['forumid'], array(22,24))"> target="_blank"</vb:if> >{vb:raw .title}</a></h2>
Lynne
11-25-2012, 03:37 PM
This worked fine for me:
<h2 class="forumtitle"><a href="{vb:link forum, {vb:raw forum}}" class="forumtitle" <vb:if condition="in_array($forum['forumid'], array('22','24'))"> target="_blank"</vb:if> >{vb:raw forum.title}</a></h2>
Dax IX
11-25-2012, 04:57 PM
Thank you both. :)
I got it to work by posting the same code in forumhome_forumbit_level2_post
For some reason I was thinking it was using forumhome_forumbit_level2_nopost
Thanks again! :)
Nirjonadda
12-08-2012, 02:53 PM
How to Usergroups able to view but can not use ?
<vb:if condition="is_member_of($bbuserinfo, 6,7,9,10,16)">
code here
</vb:if>
Ary Braga
12-19-2012, 12:59 AM
How do I get these two conditional work properly in a single task. I can not make it work.
Can someone help me?
<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43)">
<vb:if condition="$post['currentactivity']">{vb:raw post.currentactivity}
</vb:if>
</vb:if>
BirdOPrey5
12-19-2012, 07:41 PM
You just use AND to join two conditions that both must be true.
<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43) AND $post['currentactivity']">
{vb:raw post.currentactivity}
</vb:if>
AndrewSimm
12-27-2012, 11:47 PM
You just use AND to join two conditions that both must be true.
<vb:if condition="is_member_of($bbuserinfo, 5,6,7,42,43) AND $post['currentactivity']">
{vb:raw post.currentactivity}
</vb:if>
I tried using this in a CMS widget and it would not work. Any ideas?
BirdOPrey5
12-29-2012, 07:51 PM
Do you mean a widget template? Because template conditionals won't work in widget PHP code.
My guess is regardless, $post is a variable only available inside posts (the postbit template) and would not be available in any CMS template, so it would always return FALSE.
AndrewSimm
12-31-2012, 12:27 AM
Do you mean a widget template? Because template conditionals won't work in widget PHP code.
My guess is regardless, $post is a variable only available inside posts (the postbit template) and would not be available in any CMS template, so it would always return FALSE.
I see, so there is no way I could hide a block ad that I insert into a widget?
Easy5s.net
01-20-2013, 10:39 AM
in temp forumhome_lastpostby
<vb:if condition="in_array($forum['forumid'], array(12))">[{vb:raw lastpostinfo.dateline}]</vb:if>
But not work, pls hep me :(
induslady
02-13-2013, 02:38 PM
Hi All,
I would want to plugin an optimizer code only in this forum page
- http://www.indusladies.com/forums/married-life/
the code will go only in this forumdisplay page and not even in the showthread pages of htis forum - threads in this forum.
Can anyone let me know the template conditional to do the same?
Thanks.
K4GAP
02-13-2013, 02:49 PM
This is a must have for folks like me that are trying to learn so that they can be self sufficient in taking care of their site.
Thanks !
Digital Jedi
02-13-2013, 03:21 PM
Hi All,
I would want to plugin an optimizer code only in this forum page
- http://www.indusladies.com/forums/married-life/
the code will go only in this forumdisplay page and not even in the showthread pages of htis forum - threads in this forum.
Can anyone let me know the template conditional to do the same?
Thanks.
You use the Show in one forum example, using that forum's ID number in place of X.
Big-K
02-19-2013, 04:27 PM
Hello, I'm looking for a conditional that will highlight a reported post (in report thread), but not yet replied in the report thread.
The following code works to show a reported post
<vb:if condition="$post['reportthreadid'] > 0"></vb:if>
The problem is how to add the conditional that this is the ONLY post on that thread I tried replacing ">1" with "=1", but that does not work.
Lynne
02-19-2013, 05:30 PM
Hello, I'm looking for a conditional that will highlight a reported post (in report thread), but not yet replied in the report thread.
The following code works to show a reported post
<vb:if condition="$post['reportthreadid'] > 0"></vb:if>
The problem is how to add the conditional that this is the ONLY post on that thread I tried replacing ">1" with "=1", but that does not work.
I'm afraid I don't understand what you are trying to do and what template you are trying to do it in.
Big-K
02-19-2013, 07:50 PM
I'm afraid I don't understand what you are trying to do and what template you are trying to do it in.
Lynne,
I'm in postbit legacy.
What I'm trying to do is to highlight posts to let users know that the post has been reported and waiting moderators review. This will prevent users from quoting or replying to such post until someone has taken a look.
We have a dedicated forum for reported posts. So What I want to do is create a conditional in postbit that will
1) highlight the reported post (the code I posted earlier does that)
<vb:if condition="$post['reportthreadid'] > 0">THIS POST IS REPORTED</vb:if>
2) remove the highlight once there is a reply to the report in reported post forum (I was hoping the ">1" will do that, but that's not the case)
Does this explanation help please?
Lynne
02-19-2013, 11:44 PM
2) remove the highlight once there is a reply to the report in reported post forum (I was hoping the ">1" will do that, but that's not the case)
Does this explanation help please?
That is going to require a plugin to find the reported post thread and see how many replies there are to it. You cannot use just a simple template condition to check it.
Big-K
02-20-2013, 04:22 AM
That is going to require a plugin to find the reported post thread and see how many replies there are to it. You cannot use just a simple template condition to check it.
Thank you Lynne. Grateful if you can help with the plugin, but I understand if you cant.
Digital Jedi
02-20-2013, 04:22 PM
Thank you Lynne. Grateful if you can help with the plugin, but I understand if you cant.
If you haven't already, you can try and start a new thread in the modification request section, just so we don't go off track in this thread. It probably depends on how difficult this is before you'll get a reply. I'm not certain myself.
tareqbd
03-01-2013, 04:16 PM
I want to use day conditional. Please advise how to use it.
<vb:if condition="($day == 'Friday')">
Today is Friday.
<vb:else />
It's not Friday
</vb:if>
Lynne
03-01-2013, 04:55 PM
I want to use day conditional. Please advise how to use it.
<vb:if condition="($day == 'Friday')">
Today is Friday.
<vb:else />
It's not Friday
</vb:if>
I don't think it will be a simple template condition. You will need a plugin first to get the day and then you may assign it to a variable to use in your template.
tareqbd
03-01-2013, 05:24 PM
I don't think it will be a simple template condition. You will need a plugin first to get the day and then you may assign it to a variable to use in your template.
Thank you. I will try as per your advise.
How can I get registration on/of condition.
Is it like <vb:if condition="$vboptions== 1"> ?
I want to use registration on/off condition. Please help.
Lynne
03-01-2013, 05:46 PM
that would be the variable $vboptions['bbactive']
tareqbd
03-01-2013, 05:50 PM
that would be the variable $vboptions['bbactive']
But it's regarding registration active/inactive. Is it the same please?
Is it like <vb:if condition="$vboptions>registration['active']">
Lynne
03-01-2013, 08:20 PM
But it's regarding registration active/inactive. Is it the same please?
Is it like <vb:if condition="$vboptions>registration['active']">
I thought that was what you were asking about. That is the option that determines whether registration is turned on or off, or active or inactive.
Thank you. I will try as per your advise.
How can I get registration on/of condition.
Is it like <vb:if condition="$vboptions== 1"> ?
I want to use registration on/off condition. Please help.
Hilary
04-06-2013, 07:48 PM
Hello Lynne and everyone,
The smiliebox is causing havoc for me, so there are a couple of pages where I'd like it not to appear. I've worked out how to make it disappear for one of them, but I don't know how to make this happen for both.
Editing the template editor_ckeditor, every time it says 'if smiliebox' I add an extra condition:
<vb:if condition="$smiliebox" AND condition="THIS_SCRIPT != 'profile'">
That fixes it for the edit signature box. Smiliebox gone, editor full width.
But how can I make it so that the condition applies if there is a smiliebox and if I'm not on either the profile page or the showwiki page?
Huge thanks for any help.
~~~~~
Update:
I was using 'AND' because an earlier post on this thread said it was possible. Well... at least for me, it didn't work. I tried it both with and without the 'condition=' following. The result's always the same: only the final condition before the > is applied, none of the others. The example I gave above did indeed remove the smiliebox from the profile, but it had removed the first condition (which meant the smiliebox was appearing in all other editors eg quickreply). Didn't notice that until later...
The only way I found to apply three conditions was to create three nested 'ifs'. Not pretty, but it works.
Thanks to BBR-APBT for the original post!
GameOverViper
05-03-2013, 09:46 PM
I'm wanting to hide some coding for my advertisements for a specific usergroup. How do I do this?
I originally used the show for usergroup code, but apparently that's no longer working right.
Hilary
05-04-2013, 10:46 AM
What happens with
<vb:if condition!="is_member_of($bbuserinfo, 1)">ad code here</vb:if>
? (Where '1' is the number of the usergroup you don't want to see the ads, of course.) Not that I've tried this, but I have the positive version (showing certain links only to a given usergroup) and that's working fine in vB 4.
Lynne
05-04-2013, 06:35 PM
What happens with
<vb:if condition!="is_member_of($bbuserinfo, 1)">ad code here</vb:if>
? (Where '1' is the number of the usergroup you don't want to see the ads, of course.) Not that I've tried this, but I have the positive version (showing certain links only to a given usergroup) and that's working fine in vB 4.
It would actually be like this:
<vb:if condition="!is_member_of($bbuserinfo, 1)">ad code here</vb:if>
GameOverViper
05-04-2013, 07:29 PM
It would actually be like this:
<vb:if condition="!is_member_of($bbuserinfo, 1)">ad code here</vb:if>
Thanks a lot Lynne! It worked. I appreciate it! :)
Kirk93
06-23-2013, 04:45 PM
This is driving me up the f*cking wall. Can someone help me?
I've created a custom forum block template that I want to use for advertisements only. Basically, I want the advertisements to display to everyone EXCEPT for our subscribers. I've tried variations of code but either the advertisements appear to all usergroups or to none.
<vb if condition="is_member_of($bbuserinfo, 1,2,3,4,5,6,7,8,15,16,17)">
<li>
<div class="block smaller">
<div class="blocksubhead">
<a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
<span class="blocktitle">{vb:raw blockinfo.title}</span>
</div>
<div class="widget_content blockbody floatcontainer">
<div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
{vb:raw content}
</div>
</div>
</div>
<div class="underblock"></div>
</li>
</vb:if>
Can someone tell me EXACTLY how to do this? The usergroup ID for subscribed members is "11". :)
I can't seem to add an ELSE statement of any kind because all I get is an "Invalid Nesting" error.
I think the problem might be caching. Try setting "Cache Time" to 0 and see if that works.
You should be able to use <vb:else /> to have an else section (but it needs the closing slash).
ETA: also, your first line is missing a colon. It should start with <vb:if condition=....
Kirk93
06-23-2013, 07:26 PM
What should I add after <vb:else />? :)
What should I add after <vb:else />? :)
Well, I was just answering where you said you couldn't get any "else" to work. But I guess you'd do something like:
<vb:if condition="is_member_of($bbuserinfo, 1, 2, 3)">
Stuff to show to groups 1, 2, 3
<vb:else />
Stuff to show everyone else
</vb:if>
so if there's nothing that you want the other groups to see, you don't need an "else".
Do you have it working at all yet?
Kirk93
06-23-2013, 08:50 PM
I've got it how I described in the original post, except now with the colon. All groups can see the advert.
I'm trying to get it so that subscribers (11) don't see the advert, or the forum block for that matter.
So how did you create it exactly? Did you choose "Custom HTML/PHP" block? And how did you fill in the rest of the form?
Kirk93
06-24-2013, 08:39 AM
I copied the original block_html template and then made a new one named "adblock_html" with the same coding. I then added the conditionals (see above) and adjusted the settings for my Amazon advert block to use the "adblock_html" template.
That sounds good. Did you set the cache time to 0?
As Scanu posted in the other thread, something like this should work and it's a little shorter:
<vb:if condition="!is_member_of($bbuserinfo, 11)">
<li>
<div class="block smaller">
<div class="blocksubhead">
<a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
<span class="blocktitle">{vb:raw blockinfo.title}</span>
</div>
<div class="widget_content blockbody floatcontainer">
<div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
{vb:raw content}
</div>
</div>
</div>
<div class="underblock"></div>
</li>
</vb:if>
Kirk93
06-24-2013, 03:12 PM
What the...
I swear I did that yesterday. xD Ah well, that seems to have done the trick! Thank you very much mate!
Gosh, all this stuff isn't very noob friendly haha.
dougdirac
10-24-2013, 05:20 AM
What's the conditional to check if a user is a member of a particular social group?
tbworld
10-24-2013, 06:26 AM
What's the conditional to check if a user is a member of a particular social group?
What template are you going to use this conditional on? A variable for the conditional may not exist for a particular template.
dougdirac
10-24-2013, 11:29 PM
Hmm... Which templates can it work on?
ozzy47
10-24-2013, 11:41 PM
Something like this.
<vb:if condition="$group[groupid] == 106 OR $group[groupid] == 28">
HTML
</vb:if>
Change the groupid to what you want.
GameOverViper
02-26-2014, 12:55 AM
It would actually be like this:
<vb:if condition="!is_member_of($bbuserinfo, 1)">ad code here</vb:if>
This doesn't work in the sidebar. How could I hide an ad in the sidebar?
BirdOPrey5
02-26-2014, 11:39 AM
Are you making it in a sidebar template? It's not going to work in static HTML.
GameOverViper
02-26-2014, 10:18 PM
Are you making it in a sidebar template? It's not going to work in static HTML.
I'm not sure on how to do that. Any guide on how I can do that without messing anything up in the process?
CAG CheechDogg
02-27-2014, 12:20 AM
I'm not sure on how to do that. Any guide on how I can do that without messing anything up in the process?
Just copy everything from the (block_html) in your templates and create a new template and rename it to something like (block_html_user).
Then you wrap it in the conditional like this:
<vb:if condition="is_member_of($bbuserinfo, x,x,x)">
<li>
<div class="block smaller">
<div class="blocksubhead">
<a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" width="16" height="16" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
<span class="blocktitle">{vb:raw blockinfo.title}</span>
</div>
<div class="widget_content blockbody floatcontainer">
<div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
{vb:raw content}
</div>
</div>
</div>
<div class="underblock"></div>
</li>
</vb:if>
Once you do that, create a new forum block and in the "Template To Use" option add the new template you cloned, in this case "block_html_user"
And you are good to go! Make sure you replace the red "x" with the usergroups you which to only show it to.
GameOverViper
02-27-2014, 12:37 AM
Appreciate the help CheechDogg! I believe it worked for me :)
CAG CheechDogg
02-27-2014, 01:55 AM
Good stuff Game glad it worked buddy...
g00gl3r
03-25-2014, 05:25 PM
If you want to show something to somebody with less than 10 posts, what's the conditional for that?
bzcomputers
03-26-2014, 03:43 AM
If you want to show something to somebody with less than 10 posts, what's the conditional for that?
This should do it.
<vb:if condition="$vbulletin->userinfo['posts'] < 10">
YOUR CODE HERE
</vb:if>
biftek
03-31-2014, 03:40 AM
<vb:if condition="!is_member_of($bbuserinfo, 11)"><strong><bold><font color="#FF6600"> Supporter</font color></bold>
</strong></vb:if>
does that code look right?
TheLastSuperman
03-31-2014, 11:17 AM
<vb:if condition="!is_member_of($bbuserinfo, 11)"><strong><bold><font color="#FF6600"> Supporter</font color></bold>
</strong></vb:if>
does that code look right?
Try:
<vb:if condition="!is_member_of($bbuserinfo, 11)"><span style="color:#FF6600;font-weight:bold;"> Supporter</span></vb:if>
The !is means that it this condition is read as "If the user is not a member of usergroup #11 allow them to see this".
furnival
04-16-2014, 08:54 PM
This works and should replace the non-working code given in the first post. Thank you Alp Ozdemir!
Try this;
<vb:if condition="in_array($foruminfo[forumid], array(x,y,z))">
code here!
</vb:if>
hello! I want to show in some groups (1,2,3,4,5,6) postbit banner but don't know how to do it as this conditions are only to show TO groups but not FROM groups :( please help!
vbxmod
05-24-2014, 02:56 PM
hello! I want to show in some groups (1,2,3,4,5,6) postbit banner but don't know how to do it as this conditions are only to show TO groups but not FROM groups :( please help!
Try this:
<vb:if condition="is_member_of($bbuserinfo, 1,2,3,4)">Content here</vb:if>
el3reef
05-26-2014, 10:25 PM
$bbuserinfo['userid']
or
$vbulletin->userinfo['userid']
not work in vb4 :(
tbworld
05-26-2014, 11:10 PM
Please post your whole conditional statement and associated references.
What template?
What line number in that template?
What version of vBulletin?
There is no way we can determine anything from the data you have given us. :(
Try this:
<vb:if condition="is_member_of($bbuserinfo, 1,2,3,4)">Content here</vb:if>
This condition to show content TO usergroups in list but I want to show content if post FROM usergroup...
tbworld,
here is example: http://www.rcgroups.com/forums/showthread.php?t=719116#post7877841
this is vb3 forum but...
I want in postbit_legacy template for some groups add banner and change background as it's done in above forum
So my code should look like:
<div id="postbit_legacy_left">
avatar...
info...
<vb:if condition="IF USER WHO POST THIS FROM GROUPS: IDs OF PREMIUM GROUPS (1,2,3)">HERE COMES BANNER CODE</vb:if>
</div>
is it more clear now? Thanks ;)
Lynne
05-29-2014, 05:27 PM
this is vb3 forum but...
Here is the vB3 conditional thread - https://vborg.vbsupport.ru/showthread.php?t=215032
u didn't get my question... what condition for vb4 to make some stuff showed only when post created by some usergroups members?
In postbit template:
{vb:raw post.usertitle}
<!-- add banner if post made by admins and mods -->
<vb:if condition="POST_MADE_BY_IDs=6,7"><div><a href="http://www.link.to"><img src="SHOW_BANNER.png"></a></div></vb:if>
What should I put instead of POST_MADE_BY_IDs=6,7 ???
Lynne
06-01-2014, 05:13 PM
if used in the postbit templates, then:
<vb:if condition="is_member_of($post,6,7)">
stuff
</vb:if>
Dan321
06-29-2014, 09:56 AM
Need a vBulletin 5 version on page manager
RisingGlow
06-30-2014, 09:12 PM
Where would I find the ''THIS_SCRIPT'' names for files? Is there any easy way? I'm trying to find some mod additions.
Alan_SP
07-01-2014, 12:21 AM
You should look in php files of vB installation.
For example, take a look in index.php, you'll find there (in the beginning) this:
define('THIS_SCRIPT', 'index');
RisingGlow
07-01-2014, 11:42 PM
You should look in php files of vB installation.
For example, take a look in index.php, you'll find there (in the beginning) this:
define('THIS_SCRIPT', 'index');
Would there be some sort of debug option to show it? Some mods have intricate designing that it's not as simple as looking in the given php file.
Lynne
07-02-2014, 01:54 AM
If it isn't in the file, then you can't use that condition; you would need to use another condition. Your best bet is to ask in the modification thread if there is a condition you may use.
This thread is from 2010 and no one has updated the original post to reflect that $forum['forumid'] should actually read $foruminfo['forumid']. The list is technically inaccurate for noobs since the first variable doesn't work. It's been 4 years; could someone update it please? I sent a user over to fetch the conditional and he was telling me it wouldn't work. guess what, he was right!
tommyxv
12-21-2014, 09:56 PM
This conditional doesn't work anymore. Suggestions to fix it?
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>
ozzy47
12-21-2014, 10:08 PM
Try $GLOBALS['forumid'] instead of $forum[forumid].
tommyxv
12-21-2014, 10:13 PM
You da man ozzy! Worked perfectly! Thanks!
ozzy47
12-21-2014, 10:15 PM
Excellent, glad to hear. :)
HM666
02-20-2015, 03:39 PM
I have a conditionals question. I need to use two else statements within one area like this:
<vb:if condition="$GLOBALS['forumid'] == 2"><h1>This is my header</h1></vb:else>
<vb:if condition="$GLOBALS['forumid'] == 3"><h1>This is my other possible header</h1></vb:else><h1>{vb:rawphrase post_new_thread}</h1></vb:if>
Obviously its wrong, but how do I only have a particular title in only one forum and another different title in just one other forum and then have the standard vb headers for all the rest using conditionals? Or am I'm doomed to have to figure out a plugin for this little feat? Any help would be great, thanks.
I think this should work:
<vb:if condition="$GLOBALS['forumid'] == 2"><h1>This is my header</h1>
<vb:elseif condition="$GLOBALS['forumid'] == 3" /><h1>This is my other possible header</h1><vb:else /><h1>{vb:rawphrase post_new_thread}</h1></vb:if>
For future reference, here's the manual page: www.vbulletin.com/docs/html/main/template_conditionals
HM666
02-20-2015, 09:10 PM
Thanks Kevin that worked! :)
inigo
03-11-2015, 06:22 AM
Thanks for the help you provide in this post. I am looking for one conditional I haven't found in this topic.
The idea is to have a conditional in the blogs, showing a content only if it is one blog.
<vb if condition="blog user id = 3954">show this<vb if/>
But i don't know the variable to use in: "blog user id = 3954"
I want to put this in the sidebar to show special logo for the blog of each user.
Any help would be great!!!
Thanks,
HM666
03-29-2015, 08:52 AM
I'm re-coding my forum leaders page and I need a conditional to call the avatar & username of a staff member. How do I go about doing this exactly? I'm creating 3 columns and putting a user in each column coding it myself in the template but I want the ability for the avatars & usernames to change automatically if the staff member changes it in their profile. This is a custom coded page so I'm not planning on using the default vB 4 group id codes that are found in the showgroups template.
Mecho
04-28-2015, 12:23 PM
we have a section with 3 different Prefix - so they have a SAME forum ID but different prefix.
is it possible to have one message to ALL posts in that forum but only with one specific of those 3 prefixes ???
Thanks
m2006
09-23-2015, 06:45 AM
hi i need show only by ['threadid']
Skyrider
10-04-2015, 10:37 AM
Anyone happen to know the condition (for mod/supers) that IF can view user profile?
Alan_SP
10-04-2015, 12:36 PM
Do you mean this:
<vb:if condition="can_moderate()">Show this to all moderators</vb:if>
itilm
03-06-2016, 12:02 AM
hello sir i need to hide Adsense from 5 or 7 forums can you give me the code of hiding from several forums
--------------- Added 1457256110 at 1457256110 ---------------
<vb:if condition="$GLOBALS['forumid'] != x">Show this if forum id is not x</vb:if>
Please modify this code for me to multiple forums
Alan_SP
03-06-2016, 02:28 PM
For multiple forums use this:
<if condition="!in_array($GLOBALS[forumid], array(1,2,3,4,5...))>
Numbers are forum ids. You can use as many as you want.
HM666
06-28-2016, 08:39 PM
For multiple forums use this:
<if condition="!in_array($GLOBALS[forumid], array(1,2,3,4,5...))>
Numbers are forum ids. You can use as many as you want.
Sorry but this does not work. I get a PHP error & an error message when trying to change this. I want to have something NOT show in more than one forum at a time. Here is what I have from the post above but it does not work. Anyone know what I can use instead?
<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3...))>
Thanks
Dragonsys
06-29-2016, 02:03 PM
Sorry but this does not work. I get a PHP error & an error message when trying to change this. I want to have something NOT show in more than one forum at a time. Here is what I have from the post above but it does not work. Anyone know what I can use instead?
<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3...))>
Thanks
remove the ...
<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3))>
HM666
06-29-2016, 04:21 PM
remove the ...
<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3))>
Yes I know it still does not work. I put that to simulate that there would be more forum ID's. I did not want to put my actual forum ID's in the post. The code as it stands does not work.
MarkFL
06-29-2016, 04:32 PM
You need to close the condition with a double quote:
<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3))">
HM666
06-29-2016, 05:42 PM
You need to close the condition with a double quote:
<vb:if condition="!in_array($GLOBALS['forumid'], array(1,2,3))">
Ah yeah, I should not attempt these things when I'm not awake LOL. I'll give that a try I'm sure that was the problem.
Edit: That worked, thanks Mark!
Stratis
02-05-2017, 04:05 PM
I want to show image with link only in specific language and not to show in specific script.
This is my code: (works only with language) I see image in register.php
<vb:if condition="$bbuserinfo[languageid] == 2">
<vb:if condition="THIS_SCRIPT != 'register'">
<a href="register.php"><img src="images/register.png" alt="REGISTER" height="60" width="315" /></a>
</vb:if>
</vb:if>
Any help please :)
MarkFL
02-05-2017, 04:28 PM
Put your code into place on your test site, and I'll take a look. It looks to me like it should work, although I would combine the two conditions personally. :)
Stratis
02-05-2017, 04:44 PM
Put your code into place on your test site, and I'll take a look. It looks to me like it should work, although I would combine the two conditions personally. :) Ok, ready... thanks
MarkFL
02-05-2017, 05:08 PM
Ok, ready... thanks
I get a blank white page when I click the "Register" button...:)
Stratis
02-05-2017, 05:13 PM
I get a blank white page when I click the "Register" button...:)
Yep, this only happens in my test forum, never made registration to check it.
Thanks Mark. if you see that code is ok, than i will test again to see whats up
MarkFL
02-05-2017, 05:21 PM
I would combine the conditions as follows:
<vb:if condition="$show['guest'] AND $bbuserinfo[languageid] == 1 AND THIS_SCRIPT != 'register'">
<a href="register.php"><img src="images/register_now_en.png" alt="REGISTER" height="60" width="315" /></a>
</vb:if>
Stratis
02-05-2017, 05:36 PM
Thank you Mark it works, I do not know why the above does not, Any way the results matter. :)
MarkFL
02-05-2017, 05:43 PM
Thank you Mark it works, I do not know why the above does not, Any way the results matter. :)
Yeah, I can't explain why what you wrote didn't work...but glad you now have the result you were after. :D
Stratis
02-05-2017, 05:53 PM
Yes :)
For my knowledge and may be in use, how to put more than one Script I need
Lets say 'register' and "login"
Thanks
MarkFL
02-05-2017, 05:57 PM
Try:
!in_array(THIS_SCRIPT, array('register', 'login'))
within your template conditional, replacing:
THIS_SCRIPT != 'register'
Alan_SP
07-09-2017, 06:25 PM
I have a problem with this
THIS_SCRIPT != 'tags'
In default mobile style, which Google needs to have site mobile compatible, it causes problems. I need to disable showing ads in tags, it works in default style, but doesn't work in default mobile style and it also generates http 500 error, not showing thread pages and there's other problems with showing pages when I use tags within template.
Anyway, is there a way to block showing ads for tags within default mobile style? Which template is used in default mobile style to show /tags/some_tag/ link, which shows all threads with that tag?
What do i wrong here ? :eek:
<vb:if condition="is_member_of($bbuserinfo, 1) AND THIS_SCRIPT == 'commerce_cart'">
<div align="right" style="position:relative; top:-25px !important; bottom:-15px; float: right;
clear: left;">
<vb:else />
BlaBla
</vb:if >
thanx :)
MarkFL
10-11-2017, 06:23 PM
I would use the condition:
$show['guest']
to check if a user isn't a logged in registered member. It doesn't require an additional query. ;)
Oh yes, thanks for your hint Mark :up:
wraggster
02-22-2020, 05:48 PM
I need to have a conditional that shows only on the vbcms index page only, can this be done ?
Bulent Tekcan
04-05-2020, 03:26 PM
Hello,
Is it possible to remove adsense code spesific thread ?
Regards
Bulent Tekcan
04-27-2020, 03:51 PM
Hello,
Is it possible to remove adsense code spesific thread ?
Regards
Nobody ???
abcde
08-09-2020, 08:32 PM
<vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>
I tried this but doesnt seems to work anymore.
<vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>
I tried this but doesnt seems to work anymore.
Try this instead.
<vb:if condition="$GLOBALS['forumid'] == x">Show this if forum id is x</vb:if>
abcde
08-27-2020, 01:51 PM
Try this instead.
<vb:if condition="$GLOBALS['forumid'] == x">Show this if forum id is x</vb:if>
thanks
Scalemotorcars
10-13-2020, 08:14 PM
And thanks from me as well. This worked perfectly...
incisor
04-15-2022, 09:02 PM
is there a conditional that could be used to stop adverts being displayed on a page with no content ?
TIA
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.