I'm using userpoints at Ubercart.org to track member activity in the community. We have project issues setup to give 3 points to members who file them to reward bug reporting. However, we've noticed that the person who posted the issue gets 3 new points every time someone posts a follow-up to the issue, which is not what we want to happen!

The problem was in hook_nodeapi() in the userpoints_basic.module. In the switch for the update $op, if it finds that $node->uid and $orig_uid are different, then it tries to adjust the points to reflect a node's authorship change. With project issues, however, the issue node is being saved manually with node_save(), thereby bypassing the initial setting of $orig_uid. So, when the update $op comes along, it's comparing the $node->uid to a NULL $orig_uid and granting the points every time.

I applied a simple fix that should catch that here and anywhere else this might be a problem. (Really, it's probably just the project issue module, because it does a fine bit of hackery.) All I'm doing is checking to make sure $orig_uid isn't empty before switching the points on an update.

CommentFileSizeAuthor
userpoints_basic_nodeapi_fix.patch468 bytesrszrama

Comments

jredding’s picture

Status: Needs review » Fixed

merged with v3 of userpoints_basic (branch DRUPAL-5--3).

Anonymous’s picture

Status: Fixed » Closed (fixed)