Hello,

on line 182 of votingapi.module, in function _votingapi_get_raw_votes() there is this check:

if (is_integer($uid)) {
    $filter_string .= ' AND v.uid = '. $uid;
}

This function is internal, but it gets called by an exported function votingapi_get_user_votes().
When I pass $user->uid as uid to that function, nothing is appended to the $filter_string
This is a bug :)

Instead of is_integer(), is_numeric() should be called. I changed the piece of code above to the following and now it works:

if (is_numeric($uid)) {
    $uid += 0;
    $filter_string .= ' AND v.uid = '. $uid;
}

Comments

eaton’s picture

Status: Reviewed & tested by the community » Fixed

Checked in with some minor tweaks (cast to int rather than adding 0).. thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)