Closed (fixed)
Project:
User Points
Version:
4.7.x-2.2
Component:
Code: userpoints
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Jun 2007 at 19:30 UTC
Updated:
6 Nov 2007 at 15:31 UTC
I saw some chatter about this a while back but can't seem to find the submitted request.
We have a need to accumulate points for nodes. I understand that this is a User points module designed for Users but our setup would be identical except that in replace of a UID (user ID) we'd have a nid (Node ID).
My question is: Would it be a good idea to FORK this module calling it nodepoints or build this functionality into userpoints? (my thought is to fork it).
Comments
Comment #1
kbahey commentedThis is it. Pools, categories, ...etc. http://drupal.org/node/151037
Forking is very bad.
Creating a nice data model for it is the best way.
See my comments there.
Comment #2
jredding commentedI checked out using the Voting API to accumulate points on nodes and the data model is completely different. What I need is a method to accumulate points on a node in an almost identical manner to how we currently accumulate points for users (i.e. this module is perfect for it).
In order to extend this module for node point accumulation I would have to add a column for nid in both the userpoints_txn table and the userpoints table. I'd also have to modify every query so that it does a check for user points or node points. To me this seems messy which is why I was somewhat suggesting a fork of the code, although I fully understand that forks are messy themselves.
I'm not completely convinced that putting node point accumulation into this module is the right place.
Comment #3
d0t101101 commentedAny progress on this?
I'm interested in the idea of assigning points to nodes...
Comment #4
jredding@drupal.org commentedUnfortunately there hasn't been any progress on this b/c I haven't found a good data model. What are your thoughts on how you would accumulate points on nodes? Have you looked at the voting API for point accumulation?
Comment #5
vaelen commentedI've written a module that does something similar to this, except that I only pay attention to organic group nodes. My module creates a userpoints_groups table that is identical to the userpoints table except that it has an additional field for the gid (really a nid). The primary key is (uid, gid). Then I have code in hook_userpoints() when op = 'points after' to add points to my groups table if the event is one of my defined events. I pass a list of pipe separated group ids in the event field as well, and these ids receive the points. I'm doing it this way because I need to know how many points user X earned in group Y. If you were only interested in nodes and not users, you could do a similar thing but have just nid instead of (uid, nid) as the key.
Comment #6
jredding commentedWe've figured out a data model that will allow for this. Discussion is over here
http://drupal.org/node/184896