How to Limit 3 adsense ads per thread in MyBB forum

Discussion in 'Forum Management' started by softech02, Jan 24, 2015.

  1. #1
    I have been trying to add Adsense ads to my mybb forum but not able to.
    I have inserted the adsense code in postbit and the ads are being displayed but the problem is, it is showing more than 3 ads in a single thread which is against google adsese policy. Is there any way I could limit the number of ads to 3 per thread?

    In a particular thread, I have 5 replies and it is displaying 5 ads on a single page which is not in line with adsene guidelines.

    Any help regarding this will be highly appreciated.

    Sam
     
    softech02, Jan 24, 2015 IP
  2. jslirola

    jslirola Active Member

    Messages:
    39
    Likes Received:
    8
    Best Answers:
    2
    Trophy Points:
    58
    #2
    You can use a counter or redefine the condition of the code.

    Example (Adsense code after 1th, 5th and 10th reply on each page):
    <if (($postcounter - 1) % $mybb->settings['postsperpage'] == 0) || (($postcounter - 5) % $mybb->settings['postsperpage'] == 0) || (($postcounter - 10) % $mybb->settings['postsperpage'] == 0) then>
    //Adsense code goes here
    </if> 
    Code (markup):
    http://letsforum.com/Thread-MYBB-show-Adsense-after-first-post?pid=12129#pid12129
     
    jslirola, Feb 17, 2015 IP