vBulletin ModsThe Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=231525 |
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:
Show only guest:
Show specific user groups :
Show one member:
Show every one but one member:
Show only moderators of any forum:
Show Moderator of one forum: Remember to change x
Show Moderator of current forum:
Show in one forum: Remember to change x
Show is every forum but one: Remember to change x
Show in several forums:
Show in only one file: Look for define('THIS_SCRIPT', 'calendar'); in the top of the php file you want it to show in.
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.
If $customvar is set:
If $customvar equals:
If $customvar does not equal:
vBulletin else statement:
vBulletin else if statement:
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. |
subscribed!
|
Thanks for this list! :)
|
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> |
very nice, this has helped me understand all the conditionals much better.
|
subscribe too..
nice, thx u |
this is so clutch...nice
|
super, thanks & happy new yeahr ;)
|
thank you very much
|
Quote:
There's an other article here. |
Quote:
|
Hi - thanks for this post, however, can you provide conditionals for CMS sections please?
|
Quote:
You may have to preregister the var. |
Thanks
|
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:
And in template SHOWTHREAD I have next conditional:
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:
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! |
well first off this is a thread for conditionals. Thats why your not getting much help with your whole script.
Do you have a conditional specific question? If not please start a new thread and do not hijack this one. |
How would I make it so a profile option could disable a toolbar? To be more specific I am trying to make Tweetboard and Wibiya Toolbars optional via user options.
|
Quote:
|
subscribed :)
|
Quote:
|
Quote:
|
Right. From my understanding you make a custom profile field and then incorporate they field number into the conditional. No?
|
you may have to also register variables depending where you want to put it.
|
I want to setup an alias for my forum, for the porn forum. So, how I can show that forum, ONLY if the people is accessing using the alias domain name?
In PHP It is easy, but i don't know how can be possible now in vB. |
I could actually kiss you , great list was waiting for some one to get a list done like this.
|
Quote:
|
Brilliant list mate :up:
Really helps, keep up the great work. Ste |
Useful for adding a advertisement or other information after the first post on every page.
|
I want to use condition with the custom field. For example, I use custom field number 6 for private information, and I want the member can view it but hide it for everyone.
Is there any example? |
Excellent thank you very much :)
|
Quote:
Quote:
|
Quote:
the condition you give is for every member... it can not be used in this case. |
Quote:
Quote:
|
Hi RL714,
I think your code is right. But this is not simple likes that, because it is not for only a member or owner site. I mean the number 318713 is the dynamic number, it is exactly userid in custom field table. So if condition is: $bbuserinfo['userid'] is exactly his userid, so he can see the value. But if the other member can not see. For example: you can see your custom field number 6, but I can not see it. And vice versa, I can see my custom field number 6, but you can not see mine. |
Thanks :)
|
Thank you for the article.
Please guide me in converting this to vb4:
and this one too please:
|
Thanks for your article
I want to add advertisement after the first post in some special forums so I edit the "ad_showthread_firstpost" Template and add this
But nothing change in the special forums and the ads not appear also if I used this
it's appear in all forums not only the special (1,2,3) Can you advice me plz ? Best regards |
Hoping someone can help...
I'm trying to convert this template conditional (in threadbit, I'm guessing it matters)...
Using the guide here, I know it should look like this, but it doesn't work:
Could it be that the $ignore variable isn't available in that template? I've seen mention of that in other articles here, I think. |
Anyone know a way of getting this to work?
{vb:raw title} returns The Latest exactly as I would expect when put into the style but for some reason it may not be working inside a conditional statement. =\ |
Quote:
Quote:
|
this is not work too with me :(
anyone can advice ?? |
Quote:
Do you know if there is any work around? |
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...? |
What would the code be to only show on forumhome?
|
Quote:
|
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 |
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
i need to where to add the section to not allow certain groups 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 |
lol Wish I would have saw this before. Oh well, I figured it out :P Thanks for this though!
|
Quote:
|
|
:erm: errrmmm... hi
how about showing something here to a thread starter but not to his first post....is there any conditional on this please? appreciate any help thanks and best regards... :p |
Is there anything that I can pull the date of the last post of a thread?
$thread['lastpostdate'] or something like that. I'm trying to see if the last post date is older than 90 days and if so - output a custom phrase. Thanks. |
I'm trying to use a conditional to color code certain forums in the What's New and Search Results.
In search_threadbit I've tried the following, with no success (only the else shows for threads in these forums too.)
I thought that since forumid is actually in the link, it would be a piece of cake, but it's a no go as above. I must be missing something obvious. I read here about assigning a variable to a template, so tried creating a new plugin to do so, but can't seem to make that work either. One question is that the template is labeled search_threadbit but that's not a choice in the add plugin screen for a hook location - only search_results_threabit which doesn't seem to exist as a template. So I'm a bit lost there. Any guidance? Many thanks. (new to VB4 today) |
Quote:
Is it possible to put the condition in the plugin? |
Quote:
|
Is there an "at least this" conditional?
I have this conditional to list just the blogs from a specific category:
It works well, but only if the blog entry is marked with only this category (6). If I choose one more category to the blog, let's say 5 and 6, this conditional no longer works. Any help? =) |
Hi, how would you direct guests to login with <if condition>?
|
I have a custom template being called at the template hook in the postbit called postbit_userinfo_right_after_posts which works fine with static text from the template outside of conditionals, however when I try to use text in a conditional or pull a field such as {vb:var post.fieldX}, nothing happens...
I am able to call conditionals in the postbit template without any problems, just not in the custom template. The conditional and field I'm trying to use is:-
Any ideas? |
What about a conditional to have an ad appear after every 2 posts? used to be easy in vb 3.8, not now! :( :(
|
Hello,
I would like to show different size ads for memvers and guests, someone can help me to see if this code it's correct? Quote:
|
is there any conditional list to show something only if the said member is offline?
it means the below code belong to the user...so i want to hide it when they are online... it can only be seen once that they are offline...is that possible guys?
appreciate any possible help on this guys... thanks and best regards... :o |
Quote:
hmmm...:rolleyes: |
Bump!-Bump!-Bump!
:mad: |
It seems simple enough.. I wish I could help. Unfortunately I'm not familar in that area. Hopefully my response will help in attracting attention to your question. ;)
|
TalkVirginia...thanks a lot but i guess and notice that most of well experienced coder are not quite there anymore or interested of replying to any message who needs help regarding code like this or product...we have still some around but not paying or giving attention to post message like this...but if you post it to paid forum...they are quite fast and your pm box is full in a minute or 2....:p well thats my own opinion only...well i am not like that or tryin not to be like that...as long as i can...i am willing always to share my knowledge...or anything that i know...without any single cents...thanks is quite enough...
anyway hope someone who is more experienced coder someday will go reply here and share his knowledge...i might share him too some cents...;) best regards to all :p |
I think most want us to do as much research on our own, provide our analysis and findings before they offer any input. Granted, this is important to do but sometimes we need a knudge in the right direction... sometimes. :) Off the top of my head I would say you might be able to find something already existing in postbit and/or postbit_legacy where it shows the online status icon. I'll have to go back and re-read the thread I guess in case that's not what you are looking for.
--------------- Added 26 Mar 2010 at 10:39 --------------- Quote:
|
I'd like to add that you can use AND & OR for example
|
What about show to users having one post? Please? Thank you in advance! :)
|
Crystal clear - Subscribed.... thank you
|
I'm trying this in the css files stored among the templates. Anyone care to tell me whats wrong ? :)
Quote:
|
is there a way to get this to work in a CMS article? or maybe with bbcode?
|
Can we set conditional to ONLY show if user has filled in Profile Field ? Otherwise it is blank
|
I've been working with some of the code provided here to show Adsense ads to non members only.
I found that using <vb:if condition... gave an error when trying to save the code. Missing if statment relative to the </vb:if> The following worked
|
Wow thanks for this greatly appreciated; I have dedicated this entire day to me to fix up all the little things on my site such as all of the template edits, permissions and most importantly all of the conditionals and so this thread and the time taken to create it is greatly appreciated.
|
Quote:
What did work was:
Though your conditional may work in some other templates. |
Can someone tell me if this is right to put in our footer to not have something show on the CMS and to not show it to guests:
I just want someone to tell me if it is correct, if not what is correct. |
The correct this_script for CMS is
|
****UPDATE***
Ok, finally figured it out, had to pass in usergroups in the $show variable from the plugin. So in the plugin: $show[gm_ugs] = explode(',', trim($vbulletin->options['gm_user_groups_allowed'])); and in the template, the condition is: <vb:if condition="is_member_of($bbuserinfo, $show[gm_ugs])"> I'm sure that's obvious to most of you, but... just incase someone else has the same question, hopefully that helps. -------------------------- How do you check multiple usergroups in a template? Such as: <vb:if condition="is_member_of($bbuserinfo, $usergroups)"> where $usergroups = "6,15,10" Specifically: <vb:if condition="is_member_of($bbuserinfo, array($vboptions['gm_user_groups_allowed']))"> Is what I am trying, but it only seems to work if $vboptions['gm_user_groups_allowed'] is not an array and is a single value. |
Quote:
I have profile field 8 with radio single selection as the type. It's set with options of yes and no. It seems to be working.
|
Quote:
And watch how you spell 'yes' when you create your custom fields, case matters. |
Quote:
How would I be able to make a mix of this? ie: Show in all forums except for 40, 41, and 42? Cheers |
Quote:
coz the old conditional not work also the new one |
I am curious if there is a conditional that I can use in the threadbit or forumhome template that will let me display X if a certain forum is being displayed...
$forum[forumid] doesn't work in the threadbit template, it has no value at all... is there an alternative way? Basically I want to only display something if forumdisplay.php?f=2 is the page I'm on. |
subscribe.
K |
Show Moderator of one forum: Remember to change x
This condition does not work. Shows in all forums and not just 'x' !!! |
Hi guys..I have a donators group,
how can I show something only in the postbit of donators group list ? Thanks :) |
Quote:
Change "9" to your paid usergroup id... if more than one then separate by comma: 9, 10, 11 |
Quote:
..i want to show the text in the postbit of the every member of group 9, visible to other groups.. Thanks |
That would show whatever you put above the </vb:if> only to users in usergroup id 9... If you want to display it to everyone you wouldn't use the IF statement at all. I don't think I fully understand the question.
|
if the member belongs to a group,,a text should appear in the post bit of that member..
which will be visible to every one.. Thanks :) |
I have a piece of code added to the end of footer template but I want this piece of code to be visible only when i'm reading a thread (any thread).
May I ask if there's any conditional for this? |
Quote:
|
Thanks, works great!
|
I would really benefit from a similar list of conditionals from php code, rather than conditionals. I can do nearly anything I want in a template thanks to this list, but trying to determine if a user is a member of a usergroup via php code is still foreign to me. Does anybody know of a list of these, or is anybody willing to translate this list to a php counterpart list? :)
|
Quote:
Cheers |
Can anyone assist me how to show a few texts on a certain time?
Let me explain, I want my users see some texts displaying on site in the morning, however in the evening they will see another text on site. Is there a conditional for that? |
Quote:
Quote:
|
Quote:
But I can't do that by myself. I hope someone handle it :erm: I would like to use it for adsense. |
Beautiful :)
|
Please Help.
I am unable to duplicate results in other Templates I have been able to set linked images to show in the postbit_legacy template for custom profile fields with no problem using
I tried
But this shows the user who is viewing the informations link (if set) as apposed to the member who's profile they are viewing So what I am asking is, is there an alternative conditional for?
or is there something I am missing else where? Thank you in advance for any help.... |
All times are GMT. The time now is 01:26. |
Powered by vBulletin® Version 3.8.14
Copyright © 2021, 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.