Closed (fixed)
Project:
User Points
Version:
7.x-2.x-dev
Component:
Code: userpoints_rules
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Jan 2012 at 01:03 UTC
Updated:
27 Jan 2012 at 09:30 UTC
I am using the userpoints as a tipping function for live video performances here. I used an ajax dialog window to contain the tip function so as not to interrupt a playing video stream. The userpoints are 'spent' using Rules. I used the block refresh module with Heartbeat to keep a running tally of people who leave tips.
What I would like to create is a method of displaying the top 5 spenders during a performance. Any ideas?
Comments
Comment #1
berdirIt is not clear to me what your actual problem is.
You just need to make sure that you can trace a transaction back to the live performance (e.g. by using entity_type and entity_id if the video performance is an entity or with the internal reference field).
Then, all you need to do is create a query on the userpoints_transaction table, apply your limits and order by points DESC.
There is no API for that, but you don't really need one.
Comment #2
berdirNote that it should actually be rather easy to build a views for this and then you'd pass in e.g. the node id when you're on a node display as views argument and then display the list sorted by points (you might need to sort ascending as you probably have negative points transactions).