Assign Points To Node Creator
clint-jb - October 6, 2008 - 12:53
| Project: | User Points Voting API |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Description
Hi I was wondering if someone could please tell me what I change in the module file so that points go to the user who made the story instead of the user who voted. Im quite sure its simple just changing from user to node... look forward to peoples thoughts.
Cheers

#1
Points are given to the content, not to the person who voted.
#2
If you want to know how much points have been given to all content authored by the same user x, then that is the question you must ask.
#3
No I understand that points are given to the content... I want to keep it this way, I have it currently linked in with User Points though and it is allocating a point to each user individually who votes instead of giving each one of those votes to the author who made the node.
Cheers
#4
Then you'll have to check in with the User Points module.
#5
reclassifying again, Currently the userpoints voting api module gives a point to the "VOTER" and not to the "AUTHOR" of the node that is being voted upon (of course isn't this what the voting API does?).
Anyhow if this feature is still requested this is the place for it to be done.
#6
Subscribing. I have an upcoming project that will need this feature, so I'll be creating a patch if nobody beats me to it.
#7
If you want to increase points of AUTHORs than VOTERs, then insert this function
function userpoints_votingapi_author($entity_type, $entity_id) {
$entity_id_name = $entity_type[0]."id";
$entity_type .= ($entity_type == "node")? "": "s";
$uid = db_result(db_query("SELECT uid FROM {%s} WHERE %s = %d", $entity_type, $entity_id_name, $entity_id));
return $uid;
}
and then this statement in both userpoints_votingapi_votingapi_insert() and userpoints_votingapi_votingapi_delete(), right before the first if statement
$vote['uid']=userpoints_votingapi_author($vote['content_type'], $vote['content_id']);
Frankly, I can rewrite the whole .module file to keep it clean and induplicate, but I have trouble in how to contribute and/or update/commit this module.
Best regards.
#8
feel free to contact me at truongsinh.tran@vsaf.org
#9
Subscribing
#10
the same issue is being worked on separately here: http://drupal.org/node/367005
#11
I've tried to modify userpoints_votingapi.module to give points to author and voter separately.
#12
Subscribe
#13
#14
An implementation I did myself which I would like to submit. This leaves the points to voters intact but at the same time provides a method to give positive or negative points to users based on how people voted on their content (negative votes can give a negative score). Also, deleted votes will nullify any points they assigned to the author.
#15
An update to my implementation. If stops users from getting points from voting on their own content.
#16
Tweaked the patch to work with the latest version of the userpoints_votingapi module.
#17
+1
This patch applied cleanly to userpoints_votingapi-6.x-1.x-dev.tar.gz
Works well! Gives the user points to the author of the node. It accepts authors vote on his own node, but it is not included in the authors points.
Thanks for this patch! It does exactly what I was looking for.
#18
I would really like to use this feature, and I see from post #17 that the patch works. However I am not sure how to apply this patch. I would prefer to be using it in a module that someone has blessed.
Are there plans for this to be in the next release and if so when might that be?
If I want to use this patch myself, how would I go about doing that?
#19
you need to use "patch" which is a unix-based tool that will alter a file based on the instructions in the patch file. if you are on windows, use this: http://gnuwin32.sourceforge.net/packages/patch.htm