Index: userpoints_nc.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/userpoints_nc/userpoints_nc.module,v
retrieving revision 1.4
diff -u -r1.4 userpoints_nc.module
--- userpoints_nc.module	9 Jan 2009 10:35:21 -0000	1.4
+++ userpoints_nc.module	8 Oct 2009 22:42:16 -0000
@@ -33,7 +33,15 @@
         '#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('<default>');
+      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',
@@ -42,6 +50,14 @@
           '#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(
@@ -58,6 +74,13 @@
         '#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()),
@@ -65,6 +88,14 @@
         '#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',
@@ -101,10 +132,12 @@
   //static up_orig_uid please read drupal.org/node/183520 
   static $up_orig_uid;
   $points = variable_get(USERPOINTS_POST . $node->type, 0);
+  $tid = variable_get(USERPOINTS_POST . $node->type . '_category', 0);
   switch ($op) {
     case 'insert':
       $params = array(
         'points' => $points,
+        'tid' => $tid,
         'uid' => $node->uid,
         'operation' => 'insert',
         'entity_id' => $node->nid,
@@ -117,6 +150,7 @@
         $points = -$points;
         $params = array(
           'points' => $points,
+          'tid' => $tid,
           'uid' => $node->uid,
           'operation' => 'operation',
           'entity_id' => $node->nid,
@@ -145,6 +179,7 @@
         // Add to the new node owner
         $params = array(
           'points' => $points,
+          'tid' => $tid,
           'uid' => $node->uid,
           'operation' => 'Ownership gain',
           'entity_id' => $node->nid,
@@ -154,6 +189,7 @@
         // subtract from the original node owner
         $params = array(
           'points' => -$points,
+          'tid' => $tid,
           'uid' => $up_orig_uid,
           'operation' => 'Ownership loss',
           'entity_id' => $node->nid,
@@ -170,6 +206,7 @@
             // Add to the new node owner
             $params = array(
               'points' => $points,
+              'tid' => $tid,
               'uid' => $node->uid,
               'operation' => 'Ownership gain',
               'entity_id' => $node->nid,
@@ -179,6 +216,7 @@
             // subtract from the original node owner
             $params = array(
               'points' => -$points,
+              'tid' => $tid,
               'uid' => $up_orig_uid,
               'operation' => 'Ownership loss',
               'entity_id' => $node->nid,
@@ -198,10 +236,12 @@
   static $up_orig_com_uid;
 
   $points = variable_get(USERPOINTS_POST_COMMENT, 0);
+  $tid = variable_get(USERPOINTS_POST_COMMENT . '_category', 0);
   switch ($op) {
     case 'insert':
       $params = array(
         'points' => $points,
+        'tid' => $tid,
         'uid' => $user->uid,
         'operation' => 'insert',
         'entity_id' => $comment['cid'],
@@ -213,6 +253,7 @@
       $points = -$points;
       $params = array(
         'points' => $points,
+        'tid' => $tid,
         'uid' => $comment->uid,
         'operation' => 'delete',
         'entity_id' => $comment->cid,
@@ -222,8 +263,10 @@
       break;
     case 'moderate':
       $points = variable_get(USERPOINTS_MODERATE_COMMENT, 0);
+      $tid = variable_get(USERPOINTS_MODERATE_COMMENT . '_category', 0);
       $params = array(
         'points' => $points,
+        'tid' => $tid,
         'uid' => $comment->uid,
         'operation' => 'moderate',
         'entity_id' => $comment->cid,
@@ -255,6 +298,7 @@
         $points = $last_owner->points;
         $params = array(
           'points' => $points,
+          'tid' => $tid,
           'uid' => $new_uid,
           'operation' => 'Ownership gain',
           'entity_id' => $cid,
@@ -265,6 +309,7 @@
         //Take away from the original owner
         $params = array(
           'points' => -$points,
+          'tid' => $tid,
           'uid' => $last_owner->uid,
           'operation' => 'Ownership loss',
           'entity_id' => $cid,
@@ -281,6 +326,7 @@
           if ($orig_uid != $comment['uid']) {
             $params = array(
               'points' => $points,
+              'tid' => $tid,
               'uid' => $new_uid,
               'operation' => 'Ownership gain',
               'entity_id' => $cid,
@@ -291,6 +337,7 @@
             //Take away from the original owner
             $params = array(
               'points' => -$points,
+              'tid' => $tid,
               'uid' => $comment['uid'],
               'operation' => 'Ownership loss',
               'entity_id' => $new_uid,
