If an anonymous voter tries to vote again or change their vote, it causes an error in the votingapi modules since it passes a value instead of an object, as votingapi_change_vote expects an object, not a value.
Need to change the db_result in or near line 270 to db_fetch_object
--if ($old_vote = db_result(db_query("SELECT vote_id FROM {votingapi_vote} WHERE content_type = 'node' AND content_id = %d AND value_type = '%s' AND tag = 'vote' AND uid = %d AND hostname = '%s' AND timestamp > %d", $nid, $vote->value_type, $uid, $hostname, time() - (60 * 60 * 24)))){ // existing votes from the same IP address within the past day
to
--if ($old_vote = db_fetch_object(db_query("SELECT vote_id FROM {votingapi_vote} WHERE content_type = 'node' AND content_id = %d AND value_type = '%s' AND tag = 'vote' AND uid = %d AND hostname = '%s' AND timestamp > %d", $nid, $vote->value_type, $uid, $hostname, time() - (60 * 60 * 24)))){ // existing votes from the same IP address within the past day
--Greg
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | jrating_anonymous_voting.patch | 1.11 KB | Gman |
Comments
Comment #1
melon commentedIt works great. Please provide patch and let's hope the best the maintainer approves it.
Comment #2
Gman commentedHere is the patch. Please review, though it should be ready for committing now.
-Greg
Comment #3
hickory commentedCommitted, thanks for the patch.
Comment #4
(not verified) commented