Adding Adsense to Invision Power Board IPB

One of my sites I run, the Yamaha Owners Club is forever under redevelopment. The club is run voluntary by motorcycle enthusiasts and as such is all free to join. Unfortunately in today’s world with the costs of domain hosting, web hosting, maintenance and software fees it is starting to take a burden. Since the site has around 500 users a day, I felt that adding Google Adsense to the Invision Power Board forums could be of great benefit.

The problem I had however was the fact that regular users will not want Google Adsense popping up all the time, so how do I show adverts to guests and not members?

After lots of research, trial and error, and stress I managed to find a way using HTML Logic.

All is needed is a simple IF statement. The following code will only show Adsense to guests, another member group will not see adverts. Using Phpmyadmin on my database i was able to find the membergroup ids. I have also noticed that it is also carried in the URL “&id=2” from certain links within the IPB ACP.

Code cant go here as fucks messes up Wordpress! So please download HTML logic code 1

The one problem I did have with this code is that it violates Google Adsense TOS. As you cant show ads on non accessible pages or pages without content,eg. Search pages, login pages, or member only pages. So I had to come up with a work around. After about 100 attempts of modyifing the code I managed to get the final code.

Code cant go here as fucks messes up Wordpress! So please download HTML logic code 2

This will ONLY show ads to non members ie guest visitors on certain pages of the site, so is fully compliant with the Googles Terms of Service. The only one thing I would like to change is that it showed Adsense on the main front page too, but for some reason its not and I have no idea why. So any comments would be most welcome.

Well apart from being this sad over the Christmas season and working on my website, hopefully I may start making some money :-) and of course Happy Christmas and New Year to everyone.

PS: Please excuse the crap code, Wordpress has a bug with the < code>< /code> tags! The only way that the code would show was to add in a space! Another problem to look into…

PPS: After just upgrading to Wordpress 2.0 there is still a bug in there software, and its back with vengeance… so hence the external source files :-(

Post a Response

SIGN up for your FREE Globally Recognised Avatar before commenting. A gravatar is quite simply an image that follows you online from blog to blog appearing beside your name when you comment on a gravatar enabled site. Allowing you and others to quickly identify your posts and comments.

*** I'm sorry but due to the large amount of spam, comments without Gravatars will be automatically deleted ***