Gossamer Forum
Home : Products : Gossamer Forum : Development, Plugins and Globals :

Re: [carminejg3] New plug in request - Adsense Revenue Sharing

Quote Reply
Re: [carminejg3] New plug in request - Adsense Revenue Sharing In reply to
Yes, it would be pretty easy to do. If you add a column for the adsense id (or revenue generating system). Then on the post templates, you should have the tag, root_user_<column_name> (eg. root_user_adsense). So with that, you can add the advertisement to the include_post_display.html template. Say you only want the add to only show up below the first post, something like the following should work:
Code:
<%if first%>
<%set code = "my adsense code here"%>
<%if root_user_posts > 50 and root_user_adsense and rand(10) >= 5%>
<%set code = $root_user_adsense%>
<%endif%>
<%-- add code here, and user $code tag --%>
<%endif%>
Of course, replace "my adsense code here" with your own code, and replace 50 with whatever you want as well as adding any other conditions you want. The rand(10) >= 5 handles using the user's code 50% of the time.

Note that rand() wasn't added to GT::Template until gforum 1.2.4, so you'll need to upgrade to at least that version for rand (or write a rand global). You'll also have to update the preferences to allow the user to set their adsense code.

One other thing to note: so you don't get any wasted impressions, you should probably make sure you put a regex on the column that only permits valid adsense id's. I'm not sure what a valid id is, so I can't give you a regex.

Adrian
Subject Author Views Date
Thread New plugin request - Adsense Revenue Sharing katakombe 7972 Sep 17, 2007, 8:35 AM
Thread Re: [katakombe] New plugin request - Adsense Revenue Sharing
carminejg3 7612 Oct 4, 2007, 4:35 PM
Thread Re: [Carmine] New plug in request - Adsense Revenue Sharing
carminejg3 7368 Oct 30, 2007, 2:18 PM
Thread Re: [carminejg3] New plug in request - Adsense Revenue Sharing
brewt 7355 Oct 30, 2007, 10:11 PM
Thread Re: [brewt] New plug in request - Adsense Revenue Sharing
carminejg3 7363 Oct 31, 2007, 7:17 AM
Thread Re: [carminejg3] New plug in request - Adsense Revenue Sharing
brewt 7361 Oct 31, 2007, 11:41 AM
Post Re: [brewt] New plug in request - Adsense Revenue Sharing
DeadMan 7334 Nov 4, 2007, 12:00 PM
Post Re: [brewt] New plug in request - Adsense Revenue Sharing
DeadMan 7240 Jan 2, 2008, 8:45 AM
Thread Re: [brewt] New plug in request - Adsense Revenue Sharing
katakombe 7363 Nov 5, 2007, 10:12 AM
Post Re: [katakombe] New plug in request - Adsense Revenue Sharing
Andy 7172 Feb 26, 2008, 2:19 AM