vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   vB4 Template Conditionals List (https://vborg.vbsupport.ru/showthread.php?t=231525)

GameOverViper 05-04-2013 07:29 PM

Quote:

Originally Posted by Lynne (Post 2419945)
It would actually be like this:

PHP Code:

 <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.

Code:

<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.

kh99 06-23-2013 05:09 PM

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 />? :)

kh99 06-23-2013 08:34 PM

Quote:

Originally Posted by Kirk93 (Post 2430032)
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:
Code:

<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.

kh99 06-23-2013 09:02 PM

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.

kh99 06-24-2013 02:22 PM

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:

Code:

<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

Quote:

Originally Posted by dougdirac (Post 2455786)
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.

Code:

<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

Quote:

Originally Posted by Lynne (Post 2419945)
It would actually be like this:

PHP Code:

 <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

Quote:

Originally Posted by BirdOPrey5 (Post 2483858)
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

Quote:

Originally Posted by GameOverViper (Post 2483959)
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:

Code:

<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

Quote:

Originally Posted by g00gl3r (Post 2489484)
If you want to show something to somebody with less than 10 posts, what's the conditional for that?

This should do it.

Code:

<vb:if condition="$vbulletin->userinfo['posts'] < 10">
YOUR CODE HERE
</vb:if>


biftek 03-31-2014 03:40 AM

Code:

<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

Quote:

Originally Posted by biftek (Post 2490572)
Code:

<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:
Code:

<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!
Quote:

Originally Posted by Alp Ozdemir (Post 1991194)
Try this;

Code:

<vb:if condition="in_array($foruminfo[forumid], array(x,y,z))">
code here!
</vb:if>



M.C. 05-24-2014 09:15 AM

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

Quote:

Originally Posted by M.C. (Post 2499183)
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:
Code:

<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. :(

M.C. 05-29-2014 08:30 AM

Quote:

Originally Posted by vbxmod (Post 2499222)
Try this:
Code:

<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/showt...16#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

Quote:

Originally Posted by M.C. (Post 2499941)
this is vb3 forum but...

Here is the vB3 conditional thread - https://vborg.vbsupport.ru/showthread.php?t=215032

M.C. 06-01-2014 12:00 PM

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:
HTML Code:

{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:

PHP Code:

define('THIS_SCRIPT''index'); 


RisingGlow 07-01-2014 11:42 PM

Quote:

Originally Posted by Alan_SP (Post 2504680)
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:

PHP Code:

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.

Rich 07-19-2014 09:36 PM

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:
Code:

<vb:if condition="$forum[forumid] != x">Show this if forum id is not x</vb:if>


All times are GMT. The time now is 07:35 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01766 seconds
  • Memory Usage 1,845KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (13)bbcode_code_printable
  • (1)bbcode_html_printable
  • (4)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete