Just noticed that the block "User's points" doesn't show a sum of the user's points. Rather, it finds the first match from the userpoints table and uses that value. I believe this a code artifact from before we had taxonomy.
So, on line 1477 which reads:
$points = (int) db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d', $user->uid));
we'd be better off with something like this:
$points = userpoints_get_current_points($account->uid, variable_get(USERPOINTS_CATEGORY_PROFILE_DISPLAY_TID, 0));
which would use the setting from the admin page OR
$points = userpoints_get_current_points($account->uid, 'all');
to simply display a total sum, no matter the category.
Comment | File | Size | Author |
---|---|---|---|
#2 | userpoints.module.patch | 876 bytes | fred0 |
Comments
Comment #1
fred0 CreditAttribution: fred0 commentedWould love to see this get into the next build so I don't have to keep tweaking the file every time I update.
Comment #2
fred0 CreditAttribution: fred0 commentedKhalid,
Any chance we can get this into the next update?
Here it is as a patch.
Thanks!
Comment #3
kbahey CreditAttribution: kbahey commentedI hope this works just the same when no categories are used, like most people do.
Committed.
Comment #4
fred0 CreditAttribution: fred0 commentedThanks!
It's the same call as is used in the userpoints_user function to display points on the profile page so, should work the same way.
However, now that you mention it, it might make sense to add a new variable entry and form setting in the block so that the points category could be set independently of the profile page display setting. I'll try to knock that out this week and upload a new patch.