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)

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


All times are GMT. The time now is 10:48 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.01786 seconds
  • Memory Usage 1,743KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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