vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Need a <if> conditional (https://vborg.vbsupport.ru/showthread.php?t=154709)

raiderlax 08-08-2007 08:48 PM

Need a <if> conditional
 
Hello I'm looking for a conditional where say I just want to show ads to registered users(doesn't make sense :)), and not anyone else, what would the <if> conditional be for this?

Also say I want to show ads to just admins, moderators, and registered users, what is the conditional for this?

Thanks in advance :)

HMBeaty 08-08-2007 08:58 PM

The conditional to show it to your registered users is this:
HTML Code:

<if condition="$show['member']"> </if>

raiderlax 08-08-2007 09:01 PM

Thanks, would this only show it to "registered users" and no one else?

As well how would I show it to both registered users and admins?

Thanks so much :)

Attilitus 08-08-2007 09:01 PM

Code:

<if condition="$bbuserinfo['usergroupid']==2">
CODE FOR REGISTERED USERS
</if>

Replace 2 with the usergroup id that you want to display the ads to. You can also use the <else /> condition like this:

Code:

<if condition="$bbuserinfo['usergroupid']==2">
Show if usergroup id is 2
<else />
Show if usergroup id is not 2
</if>


raiderlax 08-08-2007 09:09 PM

Thanks Attilitus, so with the first code, say I want to display to both registered users and admins,

for the usergroupid, could i put ==2, 6"> ? to show to both admin/registered user?

and does this only show the add to the admin/registered user and no one else?

Thanks alot :)

HMBeaty 08-08-2007 10:04 PM

That would be correct.

Darkwaltz4 08-08-2007 10:45 PM

actually thats completely wrong :-p

what you want is...

HTML Code:

<if condition="is_member_of($vbulletin->userinfo, X)">
members of that group only see this...
</if>

Where X is the usergroupid. You can also do more than one such as
is_member_of($vbulletin->userinfo, X, Y, Z..)
dont use the dots, but basically add more usergroup ids with commas

HMBeaty 08-08-2007 10:57 PM

You can actually use either one, just the one you posted Darkwaltz4, also checks the secondary usergroup of the users

Darkwaltz4 08-09-2007 12:44 AM

no what i meant by what is wrong, is what you said was right, this:

==2, 6">

is bad php :-p, and doesnt check multiple usergroups. at the very least it would need
PHP Code:

$vbulletin->userinfo['usergroupid'] == OR $vbulletin->userinfo['usergroupid'] == 

or

PHP Code:

in_array($vbulletin->userinfo['usergroupid'], array(XY)) 

:D

raiderlax 08-09-2007 01:10 PM

Thanks guys, this is very useful!, now I have ads that I do not want to show to one usergroup, what would the conditional be to not show ads to this one usergroup?

Thanks so much :)


All times are GMT. The time now is 04:04 PM.

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.01633 seconds
  • Memory Usage 1,733KB
  • 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
  • (2)bbcode_html_printable
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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