revenue sharing doesn't work if referral is zero

Jeremy - February 9, 2006 - 01:41
Project:AdSense
Version:4.6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

in _adsense_choose_client() you the following logic causes revenue sharing to not work if the $percent_referral is 0:

if (!$percent_author || !$percent_referral || !$author_client) {
return $site_client;
}

#1

brenda003 - February 10, 2006 - 16:22
Priority:normal» critical

This is pretty critical.

#2

kbahey - February 10, 2006 - 16:33

Brenda,

This should not affect your site, since you already have the referral percentage set to a non-zero amount.

It only affects those who do not use the User Referral module, but have revenue sharing enabled.

I will investigate this over the weekend.

#3

brenda003 - February 10, 2006 - 16:40
Priority:critical» normal

Oops, you're right. I tested it briefly and didn't see any ads of the other coming up, but it was just a fluke. :)

#4

kbahey - February 11, 2006 - 20:36

Jeremy

Can you try this patch and see if it works on your site?

Thanks.

AttachmentSize
adsense_1.patch 1.23 KB

#5

kbahey - February 11, 2006 - 20:58

This one is a bit better. Give it a shot.

AttachmentSize
adsense_2.patch 1.4 KB

#6

pamphile - March 12, 2006 - 18:06

I'm using 4.6.

I don't know how to apply patches so I did this code change. It seems to work fine. But I guess referals won't work now ?

//Old Code
//  if (!$percent_author || !$percent_referral || !$author_client) {
//    return $site_client;
//  }

// New Code
  if (!$percent_author || !$author_client) {
    return $site_client;
  }

I got to learn how to apply those patches.

Marcel

#7

kbahey - March 12, 2006 - 18:27

Attaching the full module. If it works well for you, then let me know, and I will commit it.

AttachmentSize
adsense.module 27.97 KB

#8

pamphile - March 12, 2006 - 19:28

That last patched module works for me.

Thank you ! :)

Marcel

#9

kbahey - March 12, 2006 - 22:08
Status:active» closed

Committed for 4.6, 4.7 and HEAD.

 
 

Drupal is a registered trademark of Dries Buytaert.