| 1 |
<?php |
<?php |
| 2 |
// $Id: userpoints_rules.rules.inc,v 1.1 2009/08/11 15:40:49 kbahey Exp $ |
// $Id: userpoints_rules.rules.inc,v 1.1.2.1 2009/09/13 02:47:01 kbahey Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 42 |
* Rules action - grant points to a user. |
* Rules action - grant points to a user. |
| 43 |
*/ |
*/ |
| 44 |
function userpoints_action_grant_points($account, $settings) { |
function userpoints_action_grant_points($account, $settings) { |
| 45 |
userpoints_userpointsapi(array('uid' => $account->uid, 'points' => $settings['points'])); |
userpoints_userpointsapi(array('uid' => $account->uid, 'points' => $settings['points'], 'description' => $settings['description'], 'operation' => $settings['operation'])); |
| 46 |
} |
} |
| 47 |
|
|
| 48 |
/** |
/** |
| 55 |
'#default_value' => isset($settings['points']) ? $settings['points'] : '', |
'#default_value' => isset($settings['points']) ? $settings['points'] : '', |
| 56 |
'#description' => t('The number of !points to award. You may enter a negative number as-well', userpoints_translation()) |
'#description' => t('The number of !points to award. You may enter a negative number as-well', userpoints_translation()) |
| 57 |
); |
); |
| 58 |
|
$form['settings']['description'] = array( |
| 59 |
|
'#type' => 'textfield', |
| 60 |
|
'#title' => t('Description'), |
| 61 |
|
'#default_value' => isset($settings['description']) ? $settings['description'] : '', |
| 62 |
|
'#description' => t('Points description') |
| 63 |
|
); |
| 64 |
|
$form['settings']['operation'] = array( |
| 65 |
|
'#type' => 'textfield', |
| 66 |
|
'#title' => t('Operation'), |
| 67 |
|
'#default_value' => isset($settings['operation']) ? $settings['operation'] : '' |
| 68 |
|
); |
| 69 |
} |
} |
| 70 |
|
|
| 71 |
|
|
| 99 |
'#default_value' => isset($settings['amount']) ? $settings['amount'] : '', |
'#default_value' => isset($settings['amount']) ? $settings['amount'] : '', |
| 100 |
'#description' => t('The amount to compare if userpoints are >=. Example:30, will trigger the condition if the user userpoints are >= than 30 points.') |
'#description' => t('The amount to compare if userpoints are >=. Example:30, will trigger the condition if the user userpoints are >= than 30 points.') |
| 101 |
); |
); |
| 102 |
|
|
| 103 |
$form['settings']['type'] = array( |
$form['settings']['type'] = array( |
| 104 |
'#type' => 'select', |
'#type' => 'select', |
| 105 |
'#title' => t('Userpoints Categories to analyze'), |
'#title' => t('Userpoints Categories to analyze'), |