Provide a more flexible api to query about point status

ilo - March 16, 2009 - 10:15
Project:User Points
Version:HEAD
Component:Code: userpoints API
Category:feature request
Priority:normal
Assigned:Unassigned
Status:postponed
Description

The conversation started from #395500: time_stamp parameter is not considered in userpoints api as a timestamp feature is being discussed in the userpoints api.

Currently the module provides two functions to query about user points:

userpoints_get_current_points($uid = NULL, $tid = NULL);
userpoints_get_max_points($uid = NULL, $tid = NULL);

I suggest this two functions to be 'upgraded' (not replaced), supporting the $params schema as the userpointsapi does by this function:

userpoints_get_points($params = NULL)

params can be set to filter by uid, timestamp and whatever could be used to filter according to userpoints functionality.

About the two original api functions, and as we have a "timestamp" feature, the module should (imho) also provide the timestamp behaviour, allowing to query the module about the number of points a user have at some point in it's lifetime. It's as significant as to include the "AND created < %d" in the queries with a default time() timestamp, even if the module supports the future granting feature. As a module writer, I want to know how many points a user had three days ago, and as I don't manage the userpoints tables, it's the userpoints module the responsible of offering this kind of functionality to the rest of modules and it's currently missing..

#1

kbahey - March 16, 2009 - 15:00
Status:active» postponed

Good idea.

Let us keep it for when we upgrade to 7.x so as not to have API changes for 6.x

#2

ilo - March 16, 2009 - 16:30

yes, this is proposed for head and will not be included in the timestamp patch of the other issue.

 
 

Drupal is a registered trademark of Dries Buytaert.