vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Design and Graphics Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=168)
-   -   Conditionals (https://vborg.vbsupport.ru/showthread.php?t=177763)

bpat1434 05-01-2008 06:04 PM

Conditionals
 
Hi all. I'm new to this vB skinning thing and I have a question. Is it possible to limit if something (like ad sections) are shown based on a usergroup?

I.e.: If a user pays for a subscription to my forum, I'd like to remove the ads; however, they should be visible to everyone else that's not in the "subscriber" group.

Is this possible? And if so, how?

Lynne 05-01-2008 06:31 PM

In the template, put this code around the ad:
HTML Code:

<if condition="!is_member_of($bbuserinfo, x)">
Ad for users not in in usergroupid x
</else>
Stuff for users in all other usergroups
</if>

Without an else:
HTML Code:

<if condition="!is_member_of($bbuserinfo, x)">
Ad for users not in in usergroupid x
</if>


bpat1434 05-01-2008 06:52 PM

Thanks for your help. I figured it would be something as easy as that.

Is the "X" the usergroup ID?

Lynne 05-01-2008 07:32 PM

Quote:

Originally Posted by bpat1434 (Post 1504959)
Thanks for your help. I figured it would be something as easy as that.

Is the "X" the usergroup ID?

Whoops, yes, the x is the usergroup id.

HybridIllusions 05-01-2008 08:40 PM

If this doesn't work, another way would be:

Code:

<if condition="$bbuserinfo[usergroup] = X">
Replace the X with the number ID of the usergroup.

bpat1434 05-02-2008 01:03 AM

What about multiple conditions? I.e. can I use the typical php operator "||" and "&&" to make:

<if condition="!is_member_of($bbuserinfo, 26) || !is_member_of($bbuserinfo, 6)">
<!-- Ad Code -->
</if>

I.e. If they're not a member of "subscriptions" or "admin" then show the ads.

Boofo 05-02-2008 01:05 AM

<if condition="!is_member_of($vbulletin->userinfo, 6,26)">

bpat1434 05-02-2008 01:07 AM

Well that was easy!

Boofo 05-02-2008 01:24 AM

It usually is. ;)


All times are GMT. The time now is 05:20 AM.

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

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01968 seconds
  • Memory Usage 1,725KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete