function userpoints_nc_userpoints in User points Nodes and Comments 6
Same name and namespace in other branches
- 7 userpoints_nc.module \userpoints_nc_userpoints()
File
- ./
userpoints_nc.module, line 19
Code
function userpoints_nc_userpoints($op, $params = array()) {
switch ($op) {
case 'setting':
$group = 'node';
$form[$group] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('!Points for posting nodes', userpoints_translation()),
);
$form[$group][USERPOINTS_POST . '_undo_points_on_delete'] = array(
'#type' => 'checkbox',
'#title' => t('Take away !points on node delete', array_merge(userpoints_translation())),
'#default_value' => variable_get(USERPOINTS_POST . '_undo_points_on_delete', true),
);
$tree = taxonomy_get_tree(userpoints_get_vid());
$category_options = array();
$category_options[0] = t('<Uncategorized>');
if (!empty($tree)) {
foreach ($tree as $term) {
$category_options[$term->tid] = str_repeat('--', $term->depth) . $term->name;
}
}
foreach (node_get_types() as $type => $name) {
$form[$group][USERPOINTS_POST . $type] = array(
'#type' => 'textfield',
'#title' => t('!Points for posting a !node-name', array_merge(userpoints_translation(), array(
'!node-name' => $name->name,
))),
'#default_value' => variable_get(USERPOINTS_POST . $type, '0'),
'#size' => 5,
'#maxlength' => 5,
);
$form[$group][USERPOINTS_POST . $type . '_category'] = array(
'#type' => 'select',
'#title' => t('Assign !Points for posting a !node-name to category', array_merge(userpoints_translation(), array(
'!node-name' => $name->name,
))),
'#options' => $category_options,
'#default_value' => variable_get(USERPOINTS_POST . $type . '_category', 0),
);
}
$group = 'comment';
$form[$group] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('!Points for posting comments', userpoints_translation()),
);
$form[$group][USERPOINTS_POST_COMMENT] = array(
'#type' => 'textfield',
'#title' => t('!Points for posting a comment', userpoints_translation()),
'#default_value' => variable_get(USERPOINTS_POST_COMMENT, 0),
'#size' => 5,
'#maxlength' => 5,
);
$form[$group][USERPOINTS_POST_COMMENT . '_category'] = array(
'#type' => 'select',
'#title' => t('Assign !Points for posting a comment to category', array_merge(userpoints_translation())),
'#options' => $category_options,
'#default_value' => variable_get(USERPOINTS_POST_COMMENT . '_category', 0),
);
$form[$group][USERPOINTS_MODERATE_COMMENT] = array(
'#type' => 'textfield',
'#title' => t('!Points for moderating a comment', userpoints_translation()),
'#default_value' => variable_get(USERPOINTS_MODERATE_COMMENT, 0),
'#size' => 5,
'#maxlength' => 5,
);
$form[$group][USERPOINTS_MODERATE_COMMENT . '_category'] = array(
'#type' => 'select',
'#title' => t('Assign !Points for posting a comment to category', array_merge(userpoints_translation())),
'#options' => $category_options,
'#default_value' => variable_get(USERPOINTS_MODERATE_COMMENT . '_category', 0),
);
$group = 'v2compatibility';
$form[$group] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('userpoints_basic events version 2.14 Compatibility', userpoints_translation()),
'#description' => t('If you have used userpoints_basic prior to version 2.14 you may need to enable this fix.<br />
If you have not used userpoints_basic prior to v3 you do NOT need to (nor should) enable this fix. <br />
This fix only affects the behavior of how !points are handled when ownership of a node/comment
changes. In version 2 data on the original owner was not kept and a static variable was used to
store this information. Unfortunately people have experienced unusual side effects such as
!points moving from one owner to a completely random user. All !points accrued with version 3 will
not exhibit this behavior thus this fix is unnecessary.
Only check this box under the following conditions <br />
1) You have existing !points granted by a userpoints version prior to version 3 <br />
2) If ownership changes on a node/comment you want points to follow ownership <br />
<i>All !points accrued by version 3 will move ownership automatically this setting only affects !points accrued with v2</i>
<br />
3) You have read <a href="http://drupal.org/node/183520">Article 183520</a> on drupal.org and
understand that there could be unusual issues with ownership moves', userpoints_translation()),
);
$form[$group][USERPOINTS_USE_V2BUG] = array(
'#type' => 'checkbox',
'#title' => t('I agree to the above description and want to use the V2 bug fix'),
'#default_value' => variable_get(USERPOINTS_USE_V2BUG, false),
);
return $form;
break;
}
}