vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Prevent AdSense on Specified Threads (https://vborg.vbsupport.ru/showthread.php?t=270268)

TommyC 09-14-2011 04:54 PM

Prevent AdSense on Specified Threads
 
Running vBulletin 3.8, and utilizing AIN - Advanced Google Adsense ( https://vborg.vbsupport.ru/showthread.php?t=205713 ).

I'm seeking a way to prevent specified threads from having adsense ads displayed on them.

Does anyone know how this can be accomplished?

Thank you in advance.

TommyC 09-27-2011 11:09 PM

Bump.

BirdOPrey5 09-27-2011 11:30 PM

If you had the code in an ad location template you could do this easily with a template conditional, something like:

Code:

<if condition="$thread[threadid] != XXXX">
Ad code here
</if>

But I don't know how that specific mod works. You should ask for help with mods in the mod thread itself. People who have it installed (or the developer) would be in the best situation to help you.

TommyC 10-08-2011 07:31 PM

Thank you very much for the reply.

I decided to abandon the mod and just rely on template edits, using your idea of conditionals, which at first was working great. I setup my first ad block flawlessly (after much trial and error).

Then I move down to the footer, and suddenly it is as if vBulletin is unable to read IDs. That is, if I set a conditional to show the ad only if certain conditions are met, it NEVER displays the ad. If I set the conditional to show the ads with exceptions, it displays the ads EVERYWHERE regardless of the exceptions.

For example...

Using this to show my ads on forum 2:
Quote:

<if condition="in_array($forum, array(2))">
AD CODE
</if>
Result = no ads displayed on any forum, not even forum 2.

Using this to prevent my ads from showing on forum 2, 3, 4, 5:
Quote:

<if condition="!in_array($forum, array(2,3,4,5))">
AD CODE
</if>
Result = Ads displayed on EVERY forum, even forum 2,3,4,5


This carries over into other conditionals such as usergroup and threadid.

So to reiterate, one set of conditionals = working flawlessly. Other set appears to ignore IDs.

Why would this be happening? And how would I resolve it?

Thanks in advance.

Lynne 10-08-2011 07:45 PM

Try $GLOBALS['forumid'] instead.

TommyC 10-08-2011 08:06 PM

Quote:

Originally Posted by Lynne (Post 2254848)
Try $GLOBALS['forumid'] instead.

You are a scholar and a saint, that worked perfect! Thank you very much!

I'm a bit curious though, why is it that my first set of conditionals worked, yet the second set required this different variable? Is it an issue with my template?

I'm not complaining by any means as I'm very happy to have a solution, I'm just very curious.

BirdOPrey5 10-08-2011 08:20 PM

Different templates have access to different variables... Templates like header and footer are on every page, they need the "$GLOBALS" templates that are just on showthread might work with $thread or $threadinfo, templates that are just on forumdisplay make work with $forum or $forumdisplay.

TommyC 11-21-2011 05:29 AM

Is it possible to use "AND" with a conditional?

For example:
IF usergroup 3 AND forum id 2 then....
or
IF usergroup 3 AND NOT forum id 4 then ....

I've tried a few variations with no luck.

BirdOPrey5 11-21-2011 11:12 AM

AND, yes... NOT is !

Code:

<if condition="is_member_of($bbuserinfo, 3) AND $GLOBALS[forumid] == 2">

<if condition="is_member_of($bbuserinfo, 3) AND $GLOBALS[forumid] != 4">


TommyC 11-21-2011 03:29 PM

Thank you very much!


All times are GMT. The time now is 08: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.01572 seconds
  • Memory Usage 1,730KB
  • 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
  • (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