Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 02-22-2009, 03:20 AM
Tommy8x Tommy8x is offline
 
Join Date: Feb 2009
Location: Vietnam
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 02-22-2009, 07:04 AM
vbplusme vbplusme is offline
 
Join Date: Sep 2008
Location: CyberSpace
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>
Reply With Quote
  #3  
Old 02-22-2009, 07:17 AM
Tommy8x Tommy8x is offline
 
Join Date: Feb 2009
Location: Vietnam
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #4  
Old 02-24-2009, 04:58 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Tommy8x View Post
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.
Reply With Quote
  #5  
Old 02-24-2009, 05:03 AM
Tommy8x Tommy8x is offline
 
Join Date: Feb 2009
Location: Vietnam
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I want to add more user to except, how can I do with this code?
Reply With Quote
  #6  
Old 02-24-2009, 05:07 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<if condition="!in_array($bbuserinfo['userid'], array(667, X, Y, Z, 1000))">
Reply With Quote
  #7  
Old 02-24-2009, 05:17 AM
Tommy8x Tommy8x is offline
 
Join Date: Feb 2009
Location: Vietnam
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Dismounted. Have a nice day
Reply With Quote
  #8  
Old 03-01-2009, 04:25 AM
Tommy8x Tommy8x is offline
 
Join Date: Feb 2009
Location: Vietnam
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #9  
Old 03-01-2009, 07:26 PM
Mr-Moo Mr-Moo is offline
 
Join Date: Sep 2007
Location: Chicago, IL.
Posts: 130
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #10  
Old 03-02-2009, 05:03 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Tommy8x View Post
The results as userid=1 and userid=5 will not see the ads? Is that right?
Yes
Quote:
Originally Posted by Tommy8x View Post
3 users between 1 and 5 (such as id=2, 3, 4) still see the ads?
Yes
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:23 AM.


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.04480 seconds
  • Memory Usage 2,242KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (1)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete