Hello. I am using userpoints with my forum system. It works well except for people are abusing the system somewhat and posting silly posts such as one or two words or simply question marks and such to gain points.

I could eliminate this by being able to set a 10 word minimum to qualify for points. Is this possible?
Thanks, I look forwards to hearing from someone!
Cheers

CommentFileSizeAuthor
#7 userpoints_nc.module.patch17.05 KBmr.j
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kbahey’s picture

Status: Active » Closed (fixed)

Yes, possible but needs a new module to use the User Points API to do this. Perhaps part of the userpoints_nc module.

Anonymous’s picture

OOh. Marvellous sounds promising. Where can I find the userpoints_nc module?
Thanks
Tom

kbahey’s picture

Project: User Points » User points Nodes and Comments
Version: 6.x-1.0 » 6.x-1.x-dev
Component: Other » Code
Category: support » feature
Status: Closed (fixed) » Active

I am moving this as a feature request for the userpoints_nc module http://drupal.org/project/userpoints_nc

If you or someone else create a patch that makes this an option (not mandatory) with settings, that would be cool. I (or jredding) would include it in the module.

Witch’s picture

very good feature to avoid spam comments!

subscribe

mr.j’s picture

++

rjbrown99’s picture

This would be helpful, in combination with a daily limit for node+comment points.

mr.j’s picture

Status: Active » Needs review
FileSize
17.05 KB

I have a patch for this now against 6.x-1.1. This patch:

- Adds a separate minimum words setting for both comments and nodes.
- Checks the number of words after stripping html and removing any quote tags as used by quote.module. The word count check is very basic. It just splits on space boundaries.
- Grants points on insertion if word requirements are met.
- Subtracts points on update if word requirements are not met.
- Handles a single node/comment being updated multiple times with shorter and longer versions that cause points to be subtracted then added back and forth.
- Tries to preserve the v2 bugfix. This is untested as I don't use it (and I also found a bug that means it never probably worked properly on comments anyway).
- Cleans up a lot of repeated code.

I found and fixed a few bugs along the way:
- The module subtracts the current points value for a node/comment when they are deleted if the subtraction setting is activated. But it does not check to see how many points were granted when the node/comment was inserted. So if the admin has changed the points value for insertion after the item was inserted but before it was deleted, the wrong amount will be subtracted.

- The "V2 Bugfix" code incorrectly subtracts points using $new_uid for the entity_id parameter on comments instead of the $cid. So the transaction points to the totally wrong comment (if it exists).

- The "V2 Bugfix" code for comments referenced a variable that is never declared ($orig_uid instead of the declared static $up_orig_com_uid). So it would have run the code on every comment update even if the owner had not changed, creating needless transactions subtracting and adding points from and to the same user.

- The userpointsapi operation on node delete was "operation" not "delete".

- When you delete a node with comments, the points for the node are subtracted (if the option is set) but not the points granted for all the comments. This is not an easy problem to fix so I created a separate issue. #1216048: Points for comments are not subtracted when node is deleted

Status: Needs review » Needs work

The last submitted patch, userpoints_nc.module.patch, failed testing.