Closed (fixed)
Project:
Voting API
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Jun 2007 at 22:29 UTC
Updated:
21 Jun 2007 at 06:29 UTC
I am using votingapi with jrating and anonymous voting is allowed. When I first vote on a node as anonymous, the vote gets saved and displayed. But after I change this vote, or cancel this vote, the next page shows an error:
warning: Attempt to assign property of non-object in [DocumentRoot]/sites/all/modules/votingapi/votingapi.module on line 224.
Not sure what it means, I'm not a heavy php developer. Tried both votingapi 1.5 and -dev, it results the same. Using jrating dev version (because of the anonymous voting) and thus updated jquery to 1.1, but I suppose jquery doesn't play a role in this issue as it was the same when used the one in core.
Comments
Comment #1
Gman commentedThis is actually jrating's fault. It is passing a value instead of an object to the votingapi_change_vote function.
Update line 259 from
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
I will supply a patch to jrating if it is still needed.
--Greg
Comment #2
melon commentedThanks, it works like a charm. Looking for committed patch in jrating.