Download & Extend

Provide a more flexible api to query about point status

Project:User Points
Version:7.x-1.x-dev
Component:Code: userpoints
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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..

Comments

#1

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

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

#3

Hi to all, I'm looking for the same functionality. More specifically I need to know how many userpoints a user has earned in the last month, for example. I haven't found a way to do this yet. Any suggestions? Should I write my own query, counting the points of the user in the past month?

#4

Version:master» 7.x-1.x-dev
Status:postponed» active

#5

Component:Code: userpoints API» Code: userpoints

Subscribing