| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: referral.module,v 1.16.2.11 2008/12/03 17:08:27 kbahey Exp $ |
// $Id: referral.module,v 1.16.2.12 2009/03/02 20:35:04 kbahey Exp $ |
| 4 |
|
|
| 5 |
/** |
/** |
| 6 |
* @file |
* @file |
| 24 |
define('REFERRAL_HEX_LENGTH', 4); |
define('REFERRAL_HEX_LENGTH', 4); |
| 25 |
define('REFERRAL_DISPLAY_MODE', 'referral_display_mode'); |
define('REFERRAL_DISPLAY_MODE', 'referral_display_mode'); |
| 26 |
define('REFERRAL_COOKIE', 'referral_data'); |
define('REFERRAL_COOKIE', 'referral_data'); |
|
define('REFERRAL_USERPOINTS', 'referral_userpoints'); |
|
| 27 |
define('REFERRAL_GOTO_PATH', 'referral_goto_path'); |
define('REFERRAL_GOTO_PATH', 'referral_goto_path'); |
| 28 |
|
|
| 29 |
|
|
| 183 |
return; |
return; |
| 184 |
} |
} |
| 185 |
|
|
|
if (module_exists('userpoints')) { |
|
|
$points = variable_get(REFERRAL_USERPOINTS, 1); |
|
|
// Build the userpoints params array |
|
|
$params = array( |
|
|
'points' => $points, |
|
|
'uid' => $cookie['uid'], |
|
|
'operation' => 'referral', |
|
|
'entity_id' => $cookie['uid'], |
|
|
'entity_type' => 'user', |
|
|
'reference' => 'referral' |
|
|
); |
|
|
|
|
|
// Award the points to the user |
|
|
userpoints_userpointsapi($params); |
|
|
} |
|
|
|
|
| 186 |
// Invoke other modules hooks ... |
// Invoke other modules hooks ... |
| 187 |
module_invoke_all('referral', $uid, $cookie['uid']); |
module_invoke_all('referral', $uid, $cookie['uid']); |
| 188 |
} |
} |
| 556 |
} |
} |
| 557 |
return $data; |
return $data; |
| 558 |
} |
} |
|
|
|
|
function referral_userpoints($op, $points = 0, $uid = 0, $event = '') { |
|
|
switch($op) { |
|
|
case 'setting': |
|
|
$group = 'referral'; |
|
|
$form[$group] = array( |
|
|
'#type' => 'fieldset', |
|
|
'#collapsible' => TRUE, |
|
|
'#collapsed' => TRUE, |
|
|
'#title' => t('!Points for referral', userpoints_translation()), |
|
|
); |
|
|
|
|
|
$form[$group][REFERRAL_USERPOINTS] = array( |
|
|
'#type' => 'textfield', |
|
|
'#title' => t('!Points for referring a user', userpoints_translation()), |
|
|
'#default_value' => variable_get(REFERRAL_USERPOINTS, 0), |
|
|
'#size' => 5, |
|
|
'#maxlength' => 5, |
|
|
); |
|
|
return $form; |
|
|
} |
|
|
} |
|
|
|
|