vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Hide ads for specified some users (https://vborg.vbsupport.ru/showthread.php?t=206186)

Tommy8x 02-22-2009 03:20 AM

Hide ads for specified some users
 
Hi, I've put the ads on my forum but it made the page loading is more slower for serveral users, I want to hide these ads code for that users. Can anyone help me find the PHP code to do it?

vbplusme 02-22-2009 07:04 AM

That's pretty weird that the load slowly only for some users? What kind of ads?

You could wrap your ads call with a conditional, for example,

Code:

<if condition="$bbuserinfo['userid'] != 667">

Your ads code

</if>


Tommy8x 02-22-2009 07:17 AM

Because my hosting located in Vietnam and that user is in USA.

Above code will only show the ads for userid=667 but everyone cant see the ads, is this true?

Dismounted 02-24-2009 04:58 AM

Quote:

Originally Posted by Tommy8x (Post 1751205)
Above code will only show the ads for userid=667 but everyone cant see the ads, is this true?

It will do the opposite. It will show ads to everyone except user ID 667.

Tommy8x 02-24-2009 05:03 AM

If I want to add more user to except, how can I do with this code?

Dismounted 02-24-2009 05:07 AM

Code:

<if condition="!in_array($bbuserinfo['userid'], array(667, X, Y, Z, 1000))">

Tommy8x 02-24-2009 05:17 AM

Thanks Dismounted. Have a nice day :D

Tommy8x 03-01-2009 04:25 AM

Example:
PHP Code:

<if condition="!in_array($bbuserinfo['userid'], array(1, 5))">
Ads code
</if> 

The results as userid=1 and userid=5 will not see the ads? Is that right?

3 users between 1 and 5 (such as id=2, 3, 4) still see the ads?

Mr-Moo 03-01-2009 07:26 PM

That is correct,

You will have to put every userid number into the array for it to reflect the display properties.

Another alteration for this is to have it go by usergroup instead of userid and simply add the usergroup to this instead of having to manually edit the code every time you want to add/remove someone from the option.

Dismounted 03-02-2009 05:03 AM

Quote:

Originally Posted by Tommy8x (Post 1757355)
The results as userid=1 and userid=5 will not see the ads? Is that right?

Yes
Quote:

Originally Posted by Tommy8x (Post 1757355)
3 users between 1 and 5 (such as id=2, 3, 4) still see the ads?

Yes


All times are GMT. The time now is 05:48 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.01052 seconds
  • Memory Usage 1,731KB
  • 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
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete