Hi Michelle,

I've been trying to figure this out and figured you might be able to put me on the right track.

I have userpoints installed, along with Adv Forum and Adv Profile.

Userpoints is working, as the the link it has on the menu that lists the top X users by point shows the proper points for each user, and properly adds points on each comment and such.

However, on advanced forum (and in the advanced profile using bio), it says "Points: 0" for every user. I'm wondering what might be a miss and what hooks to I look for to troubleshoot this?

Thanks!

Comments

michelle’s picture

Status: Active » Postponed (maintainer needs more info)

What version of userpoints? I'm using 3.x on my site and it's working fine, there. The function call may have changed since earlier versions.

Michelle

beezkn’s picture

I am using 3.3

; $Id: userpoints_basic.info,v 1.1.2.7.2.2 2007/10/14 16:45:06 jredding Exp $
name = Userpoints Basic
description = Userpoints for core Drupal, such as posting nodes and comments, and moderating comments.
package = Userpoints
dependencies = userpoints

; Information added by drupal.org packaging script on 2008-01-30
version = "5.x-3.3"
project = "userpoints"
datestamp = "1201726220"

beezkn’s picture

Here is the code in advforum... I have tested it is enabled, but it is returning "0" from the userpoints call. I have also confirmed it is passing the proper value in $accountid.

I will keep troubleshooting, as it seems the UP call is the culprit, but if you have any ideas let me know.

// Points
if (module_exists('userpoints')) {
$variables['points_raw'] = userpoints_get_current_points($accountid);
$variables['points'] = '

' . t('Points: ') . '' . $variables['points_raw'] . '

';
}

beezkn’s picture

I resolved it with a bit a of patchwork. Apparently in userpoints, the call referenced was returning nothing for "$tid".

function userpoints_get_current_points($uid = NULL, $tid = NULL) {
if (!$uid) {
global $user;
$uid = $user->uid;
}
if (!$tid) {
$tid = userpoints_get_default_tid();
}
return (int)db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d AND tid = %d', $uid, $tid));
}

So what I did was create 2nd function, removing the $tid part of the query, and renamed the call in AdvForum module and now it works. Not sure what $tid is, but it is working.

function userpoints_get_current_pointsAF($uid = NULL) {

return (int)db_result(db_query('SELECT points FROM {userpoints} WHERE uid = %d', $uid));
}

michelle’s picture

Status: Postponed (maintainer needs more info) » Fixed

Glad you got it working. Weird that you had to change the module. Userpoints works fine as is for me.

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.