There are options to pass a $uid to set / get votes, but the code does wrong checking on the $uid.

if ($uid == NULL) {

will return true in case the $uid is 0 or NULL. The check should be isset($uid) which returns FALSE in case the $uid is 0 and only will return TRUE if the $uid is not set or NULL.

The attached patch fixes this, and cleans up some whitespace from the end of the lines.

CommentFileSizeAuthor
#2 votingapi-316912.2.patch1.37 KBChris Charlton
is_null.patch8.36 KBPoetro

Comments

Chris Charlton’s picture

Another way could be if ($uid === NULL) {

Chris Charlton’s picture

StatusFileSize
new1.37 KB

Here's my patch which is smaller (only containing the !isset($uid) changes. The attached patch is not from the CVS checkout but a local copy I had on hand.

eaton’s picture

Status: Needs review » Closed (won't fix)

Support for the 5.x branch of VotingAPI has ended with the release of Drupal 7 and the upcoming release of VotingAPI 7.x-2.4.