| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: referral_userpoints.module,v 1.1 2008/11/26 20:06:09 kbahey Exp $ |
// $Id$ |
|
// |
|
|
define('REFERRAL_USERPOINTS', 'referral_userpoints'); |
|
|
|
|
|
function referral_userpoints_user($op, &$edit, &$account) { |
|
|
if ($op != 'referral') { |
|
|
return; |
|
|
} |
|
| 4 |
|
|
| 5 |
$referring_uid = $account->uid; |
define('REFERRAL_USERPOINTS', 'referral_userpoints'); |
| 6 |
|
|
| 7 |
$params = array( |
/** |
| 8 |
|
* Implementation of hook_referral |
| 9 |
|
*/ |
| 10 |
|
function referral_userpoints_referral($new_uid, $referring_uid) { |
| 11 |
|
userpoints_userpointsapi(array( |
| 12 |
'points' => variable_get(REFERRAL_USERPOINTS, 0), |
'points' => variable_get(REFERRAL_USERPOINTS, 0), |
| 13 |
'uid' => $referring_uid, |
'uid' => $referring_uid, |
| 14 |
'operation' => 'referral', |
'operation' => 'referral', |
| 15 |
'entity_id' => $referring_uid, |
'entity_id' => $referring_uid, |
| 16 |
'entity_type' => 'user', |
'entity_type' => 'user', |
| 17 |
'reference' => 'referral' |
'reference' => 'referral' |
| 18 |
|
) |
| 19 |
); |
); |
|
userpoints_userpointsapi($params); |
|
|
|
|
|
// Check to see if the role needs to be elevated |
|
|
if (function_exists('userpoints_role_userpoints')) { |
|
|
userpoints_role_userpoints('points after', 0, $referring_uid, ''); |
|
|
} |
|
| 20 |
} |
} |
| 21 |
|
|
| 22 |
|
/** |
| 23 |
|
* Implementation of hook_userpoints |
| 24 |
|
*/ |
| 25 |
function referral_userpoints_userpoints($op, $points = 0, $uid = 0, $event = '') { |
function referral_userpoints_userpoints($op, $points = 0, $uid = 0, $event = '') { |
| 26 |
if ($op == 'setting') { |
if ($op == 'setting') { |
| 27 |
$group = 'referral'; |
$group = 'referral'; |