### Eclipse Workspace Patch 1.0
#P userpoints_contrib
Index: userpoints_register/userpoints_register.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints_contrib/userpoints_register/userpoints_register.module,v
retrieving revision 1.1
diff -u -r1.1 userpoints_register.module
--- userpoints_register/userpoints_register.module 11 Mar 2009 19:38:42 -0000 1.1
+++ userpoints_register/userpoints_register.module 23 Aug 2010 00:31:28 -0000
@@ -6,6 +6,8 @@
define('USERPOINTS_REGISTER_REGISTER', 'userpoints_register_register');
define('USERPOINTS_REGISTER_TID', 'userpoints_register_tid');
+define('USERPOINTS_REGISTER_DISPLAY', 'userpoints_register_display');
+define('USERPOINTS_REGISTER_MODERATION', 'userpoints_regster_moderate');
/*
* Implementation of hook_userpoints()
@@ -36,10 +38,24 @@
'#title' => t('Category'),
'#default_value' => variable_get(USERPOINTS_REGISTER_TID, 0),
'#options' => userpoints_get_categories(),
- '#description' => t('Registration will be assigned to this category. You can modify what categories are available by modifying the Userpoints taxonomy.',
+ '#description' => t('Registration will be assigned to this category. You can modify what categories are available by modifying the Userpoints taxonomy.',
array('!url' => url('admin/content/taxonomy/'. variable_get(USERPOINTS_CATEGORY_DEFAULT_VID, '')))),
);
-
+
+ $form[$group][USERPOINTS_REGISTER_DISPLAY] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Display message to user upon registering'),
+ '#default_value' => variable_get(USERPOINTS_REGISTER_DISPLAY, 1),
+ '#description' => t('If disabled, UserPoints will hide informational message about the points during registering. Useful for situations, where username is not fully available, such as when using Content Profile module.'),
+ );
+ $form[$group][USERPOINTS_REGISTER_MODERATION] = array(
+ '#type' => 'radios',
+ '#title' => t('Moderation'),
+ '#default_value' => variable_get(USERPOINTS_REGISTER_MODERATION, 0),
+ '#options' => array( 0 => t('No'), 1 => t('Yes') ),
+ '#description' => t('Points for registration can be moderated if moderation is set to "Yes".'),
+ );
+
return $form;
}
}
@@ -49,18 +65,18 @@
* Awards the points for registering
*/
function userpoints_register_user($op, &$edit, &$account, $category = NULL) {
- if ($op != 'insert') {
- return;
- } else{
- // Award the points - implementation of hook_userpointsapi()
- userpoints_userpointsapi(array(
- 'points' => variable_get(USERPOINTS_REGISTER_REGISTER, 0),
- 'uid' => $account->uid,
- 'operation' => 'login',
- 'entity_id' => $account->uid,
- 'entity_type' => 'user',
- 'tid' => variable_get(USERPOINTS_REGISTER_TID, 0),
- ));
+ if ($op == 'insert') {
+ // Award the points - implementation of hook_userpointsapi()
+ $param = array(
+ 'points' => variable_get(USERPOINTS_REGISTER_REGISTER, 0),
+ 'uid' => $account->uid,
+ 'operation' => 'register',
+ 'entity_type' => 'user',
+ 'entity_id' => $account->uid,
+ 'tid' => variable_get(USERPOINTS_REGISTER_TID, 0),
+ 'display' => variable_get(USERPOINTS_REGISTER_DISPLAY, 1),
+ 'moderate' => variable_get(USERPOINTS_REGISTER_MODERATION, 0),
+ );
+ userpoints_userpointsapi($param);
}
-
}