Jump to content

[PAID] Disable adsense/code if one post has particular flag


Recommended Posts

Essentially sometimes our content is NSFW and Google Adsense does not like it when we show ads when there is that content.

What I think I need is a DB query (or flag of some kind) which will not put this in the HTML (GlobalTemplate - <body> section).

<script data-ad-client="ca-pub-6991445029332292" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

 

So how I *think* it should work, is grab the URL, figure out what posts would be included on this particular page and then just search for the NSFW column we have in a table, and if adult<=3  on all of them it would print the code above in the <head> otherwise don't print anything. 

 

Here is a rough query I wrote that would accomplish this

SELECT adult FROM zzz_ibf_core_attachments WHERE attach_id IN (SELECT attachment_id FROM `ibf_core_attachments_map` WHERE `id2` IN (SELECT * FROM (SELECT pid FROM `ibf_forums_posts` WHERE `topic_id` = 60196 and pid>=4518005 limit 20) temp_tab) )

Essentially its grabbing the first 20 posts from the topic 60196 starting from post 4518005 and then figuring out all the attachments associated with those posts and then joining to zzz_ibf_core_attachments which is where i have the "adult" column which is 1-5 where 4 or 5 is NSFW. Here is the result from the query above. 

adult
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1

 

So in that case its OK to show ads, if any one of those is >=4 then we should not show the code.

 

Please let me know if you think you could be of assistance and how much it would cost. Thank you.

 

James

Edited by maddog107_merged
Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...