Hi,

I found that whenever I rate on a node, it returns back. So I took a look at the function _fivestar_cast_vote and I find the issue to be around:

      $votes = $criteria += array('value' => $value, 'uid' => $uid);
      votingapi_set_votes($votes, $user_votes);
      return $votes[0];

From what I saw in the votingapi, $votes is not sent in as a reference (it returns back an array $touched) and so the votes array seems to be lacking a lot of information. I found that by changing the return line to (note that this is around line 630 of fivestar.module to help track it down a little better - I apologize for not having this in a patch format as I didn't checkout the fivestar module to run a diff against):

      votingapi_set_votes($votes, $user_votes);
      $results = votingapi_select_results(array('content_type' => $type, 'content_id' => $cid, 'tag' => $tag));
      return $results;

I was able to display the correct set of results. However, I haven't done any further testing if anything else falters as a result.

Comments

quicksketch’s picture

Looks like there was a problem on both ends between Fivestar and VotingAPI. First, it doesn't look like Fivestar was returning the correct data from _fivestar_cast_vote(). I though I could return the $votes array directly after setting the new votes, but seems this isn't the case.

The second problem is, like you report, votingapi_set_votes() doesn't take the $votes variable by reference. In order for Fivestar to work with Drupal 6 you need to apply the following patches from VotingAPI:

http://drupal.org/node/223517
http://drupal.org/node/232236
http://drupal.org/node/232233

I'll try to get on Eaton's case again to apply these patches. I've committed the fix necessary from Fivestar's side. You can try out the latest dev version or wait for 1.12 (a few weeks out yet).

quicksketch’s picture

Status: Active » Fixed

The above patches have all been applied to VotingAPI and Fivestar is now working properly with 6.x-2.0-beta2. Note that Views support is still not yet implemented in VotingAPI.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

flyingL123’s picture

I'm using Drupal 6 and the most recent versions of Voting API and Five Star, but I am still experiencing the issue described in this post. Each of the star displays in my views show "No Votes Yet" instead of the actual summary with the number of votes and the average rating. Does anyone know how to fix this assuming the patches described above have all been added to the newest versions of these modules (which I am using).

Thanks a lot!

newmediaist’s picture

Version: 6.x-1.11-beta5 » 6.x-2.x-dev

Just an update - I'm using Drupal 6 and the most recent DEV versions of Voting API and Five Star as well, and also still experiencing this exact issue, 'no votes yet' being displayed under every vote.

summit’s picture

Status: Closed (fixed) » Active

Hi, setting this to active again, because the issue is not solved with latest voting api and latest fivestar using views.
If it is wrong to set this to active, I apologize.
Getting also the message "no votes yet" for anonymous users, while there are votes on the node.
Any solution please?
Greetings, Martijn

whiteph’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

We can no longer support the Drupal 6 version of Fivestar. It is in security maintenance mode only. When the Drupal 8 version of Fivestar is released, the Drupal 6 version will be officially deprecated.

whiteph’s picture