Ubercart Userpoints Invite reward on purchase module

Contrib type: 
Module
Status: 
Uploaded for testing
Moderation: 
Awaiting moderation

Downloads

Compatibility: 
Ubercart 2.x

This module is an addition to the userpoints and ubercart modules, it bridges userpoints, ubercart and the userpoints invite module. It allows a site admin to reward users for inviting a friend, then when the invited friend makes a purchase the inviter receives some points.


PreviewAttachmentSize
userpoint_ubercart_invite.tar10.5 KB
PaniX's picture
Offline
Joined: 01/27/2010
Juice: 95
Re: Ubercart Userpoints Invite reward on purchase module

Great Feature. What you have created is kind of very important for a great variety of projects. Thanks for contributing this and good job.

luketarplin's picture
Offline
Joined: 04/26/2010
Juice: 203
Re: Re: Ubercart Userpoints Invite reward on purchase module

Thanks!

PaniX's picture
Offline
Joined: 01/27/2010
Juice: 95
hey again mate, i am

hey again mate,

i am experiencing a weird problem.
Person X invites a user Y, the user Y registers and makes a purchase. Then user X gets the points. All fine with this.
After Everytime the user X makes a purchases (not user Y) he gets awarded points everytime he checksout.

Also user Z registers to the site, withought any invitation. Everytime user Z makes a purchase he gets awarded points.

Could there be a problem to the module. I am telling this because i also get a wird message in the form --> User ' ' has been awarded 10 points.
The variable of the users name is empty.

After a lot of tracing on the several things...this happens when i enable this module.

luketarplin's picture
Offline
Joined: 04/26/2010
Juice: 203
Re: Ubercart Userpoints Invite reward on purchase module

Hi thanks for letting me know, I haven't come across that problem myself, so it could be something to do with the modules you have installed, I will take a look and see if I can spot anything, however I am quite busy at the moment, so wont be able to do this right away I'm afraid.

Luke

PaniX's picture
Offline
Joined: 01/27/2010
Juice: 95
Ok no worries. For now i

Ok no worries.

For now i managed to overcame this byt just including a small condition. Basically i was getting a message User '' (<- empty) has been awarded 10 points.
so for the time being i simply added the following to the code

if($res->reclaimed == (int)0){
//Reclaim the amount for the inviter
if ($u->name != "") {
$responseArray = module_invoke('userpoints','userpointsapi',$pointsArray);
db_query("UPDATE {userpoint_ubercart_invite} set `reclaimed` = 1 where `invitee` = %d limit 1;",check_plain($res->invitee));
if($responseArray['status']){
drupal_set_message("Ο χρήστης `".$u->name."` έχει λάβει ".variable_get('userpoint_ubercart_invite_points',0)." πόντους.");
}
}

luketarplin's picture
Offline
Joined: 04/26/2010
Juice: 203
Hi PaniX, Thanks for the

Hi PaniX,

Thanks for the patch, may look at incorporating it in to the module! Will try and debug first though.

Luke

s2sz's picture
Offline
Joined: 05/07/2011
Juice: 13
Thank you!!

First of all I just want to give you a one big THANK YOU!
I have been searching everywher for something that allows me to award inviters for invitee´s first purchases so this is greatly appreciated!

More to the point.. I encountered the same problem as PaniX described and his solution seems to have fixed it.
And another minor bug I noticed was that when you have been awarded points because the one you invited has made a purchase, in the overview at mysite.com/myuserpoints it says "Userpoints awarded due to user: `Inviter-name` making a purchase!", so the inviter name is written instead of the invited users name, changing the ".$u->name" to .$user->name" at the following line 'description' => t('Userpoints awarded due to user: `'.$u->name.'` making a purchase!'), seems to have solved the problem!

Thanks again greatly for this module!!

Regards,
Gilli

sarhansg's picture
Offline
Joined: 12/09/2011
Juice: 3
Great Module

I think this module helps answer a very important need. However, I'm experiencing the same issue as #3. I've set the option to the following:

- Award points for successful invitation
- Award points the first time the user makes an order only

nyleve's picture
Offline
Joined: 03/15/2010
Juice: 71
Hi,does this module have a

Hi,

does this module have a drupal.org project? It's a great contribution and I would like to port it to D7.

Thanks,

Evey

EDIT: perhaps it could be added to http://drupal.org/project/userpoints_ubercart?

nyleve's picture
Offline
Joined: 03/15/2010
Juice: 71
D7 Port

A D7 port of the module. Juan did the hard work I just sponsored.

AttachmentSize
userpoint_ubercart_invite(1).zip 3.45 KB
luketarplin's picture
Offline
Joined: 04/26/2010
Juice: 203
Re: D7 Port

Hi nyleve, I will add this to the main download section of this project if you would like.