This module doesn't currently allow setting the category from which Userpoints should be deducted, yet it is possible to categorize them, and we do this on the site I'm working on.

I'm going to modify it to allow that, and I will then submit a patch.

It seems this module hasn't changed between its 1.0beta release and its 1.x-dev release, but the patch will be against dev since it's really supposed to be...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wizonesolutions’s picture

Here is the patch. I changed the function that checks for the variable, the one that updates it if the node type changes, and of course added an option to set it on the node forms. Also added a space to the end of the file.

Hope it gets reviewed!

Kevin

wizonesolutions’s picture

Status: Active » Needs review

...and for that to happen, I should set it to needs review...which I am now doing.

Berdir’s picture

Status: Needs review » Needs work
+++ userpoints_nodelimit/userpoints_nodelimit.module
@@ -109,6 +109,14 @@ function userpoints_nodelimit_node_settings_form(&$form) {
+    '#default_value' => variable_get('userpoints_nodelimit_category_'. $form['#node_type']->type, '0'),

I think the default value should user userpoints_get_default_tid().

+++ userpoints_nodelimit/userpoints_nodelimit.module
@@ -144,7 +154,9 @@ function userpoints_nodelimit_node_type($op, $info) {
+  $selected_tid = variable_get('userpoints_nodelimit_category_' . $nodetype, NULL); //Retrieve the category against which they are checking points
+  if ($selected_tid == 0) $selected_tid = NULL; //If uncategorized, then revert to standard behavior

Can you move these comments above the code? Also add a period at the end.

Powered by Dreditor.

wizonesolutions’s picture

Whoa, blast from the past! I'll try to do this though when I have a moment. Thank you for reviewing!

neovalis’s picture

exactly what I need!

neovalis’s picture

This is working perfectly on my site. Thanks!