function userpoints_nc_userpoints in User points Nodes and Comments 7
Same name and namespace in other branches
- 6 userpoints_nc.module \userpoints_nc_userpoints()
Implements hook_userpoints().
File
- ./
userpoints_nc.module, line 153
Code
function userpoints_nc_userpoints($op, $params = array()) {
switch ($op) {
case 'setting':
drupal_add_js(drupal_get_path('module', 'userpoints_nc') . '/userpoints_nc.js');
$form['userpoints_nc'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Content'),
'#group' => 'settings_additional',
'#weight' => 15,
);
$form['userpoints_nc']['userpoints_nc_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enabled by default.'),
'#default_value' => userpoints_nc_get_setting('enabled', NULL, TRUE),
'#description' => t('If checked, all content types award !points by default. This can be overridden for each content type on the content type edit page.', userpoints_translation()),
);
$form['userpoints_nc']['userpoints_nc_published_only'] = array(
'#type' => 'checkbox',
'#title' => t('Only award !points for published content.', userpoints_translation()),
'#default_value' => variable_get('userpoints_nc_published_only', TRUE),
'#description' => t('If checked, users only receive !points when content is published.', userpoints_translation()),
);
$form['userpoints_nc']['userpoints_nc_ownership_deduct'] = array(
'#type' => 'checkbox',
'#title' => t('Deduct !points when the content author changes.', userpoints_translation()),
'#default_value' => variable_get('userpoints_nc_ownership_deduct', TRUE),
'#description' => t('If checked, the old author will lose any !points that he previously gained. This setting can be overridden for each content type.', userpoints_translation()),
);
$form['userpoints_nc']['userpoints_nc_delete_deduct'] = array(
'#type' => 'checkbox',
'#title' => t('Deduct !points when content is deleted or unpublished.', userpoints_translation()),
'#default_value' => variable_get('userpoints_nc_delete_deduct', TRUE),
'#description' => t('If checked, the author will lose any points that he previously gained. This setting can be overridden for each content type.', userpoints_translation()),
);
$form['userpoints_nc']['userpoints_nc_points'] = array(
'#type' => 'textfield',
'#title' => t('Default !points for new content', userpoints_translation()),
'#description' => t('Set the default number of !points to be awarded when a user adds new content. This can be overridden for each content type.', userpoints_translation()),
'#default_value' => userpoints_nc_get_setting('points'),
'#size' => 5,
'#maxlength' => 5,
);
$form['userpoints_nc']['userpoints_nc_category'] = array(
'#type' => 'select',
'#title' => t('Default !points category for new content', userpoints_translation()),
'#description' => t('Choose the category of !points to be used by default when a user adds new content. This can be overridden for each content type.', userpoints_translation()),
'#options' => userpoints_get_categories(),
'#default_value' => userpoints_nc_get_setting('category'),
);
$form['userpoints_nc_comment'] = array(
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#collapsed' => TRUE,
'#title' => t('Comments'),
'#group' => 'settings_additional',
'#weight' => 20,
);
$form['userpoints_nc_comment']['userpoints_nc_comment_enabled'] = array(
'#type' => 'checkbox',
'#title' => t('Enabled by default.'),
'#default_value' => userpoints_nc_get_setting('comment_enabled', NULL, TRUE),
'#description' => t('If checked, all content types award !points by default. This can be overridden for each content type on the content type edit page.', userpoints_translation()),
);
$form['userpoints_nc_comment']['userpoints_nc_comment_published_only'] = array(
'#type' => 'checkbox',
'#title' => t('Only award !points for published comments.', userpoints_translation()),
'#default_value' => variable_get('userpoints_nc_comment_published_only', TRUE),
'#description' => t('If checked, users only receive !points when comments are published.', userpoints_translation()),
);
$form['userpoints_nc_comment']['userpoints_nc_comment_ownership_deduct'] = array(
'#type' => 'checkbox',
'#title' => t('Deduct !points when the comment author changes.', userpoints_translation()),
'#default_value' => variable_get('userpoints_nc_comment_ownership_deduct', TRUE),
'#description' => t('If checked, the old author will lose any !points that he previously gained. This setting can be overridden for each content type.', userpoints_translation()),
);
$form['userpoints_nc_comment']['userpoints_nc_comment_delete_deduct'] = array(
'#type' => 'checkbox',
'#title' => t('Deduct !points when comments are deleted or unpublished.', userpoints_translation()),
'#default_value' => variable_get('userpoints_nc_comment_delete_deduct', TRUE),
'#description' => t('If checked, the author will lose any points that he previously gained. This setting can be overridden for each content type.', userpoints_translation()),
);
$form['userpoints_nc_comment']['userpoints_nc_comment_points'] = array(
'#type' => 'textfield',
'#title' => t('Default !points for new comments', userpoints_translation()),
'#description' => t('Set the default number of !points to be awarded when a user adds a comment. This can be overridden for each content type.', userpoints_translation()),
'#default_value' => userpoints_nc_get_setting('comment_points'),
'#size' => 5,
'#maxlength' => 5,
);
$form['userpoints_nc_comment']['userpoints_nc_comment_category'] = array(
'#type' => 'select',
'#title' => t('Default !points category for new comments', userpoints_translation()),
'#description' => t('Choose the category of !points to be used by default when a user adds a comment. This can be overridden for each content type.', userpoints_translation()),
'#options' => userpoints_get_categories(),
'#default_value' => userpoints_nc_get_setting('comment_category'),
);
return $form;
break;
}
}