I have essentially hacked comments into reviews of a node, having a comment field of 'rating' with a fivestar widget. I was hoping it would be a trivial call to the voting API to fetch the rating of each 'review' so I could work out a nodes average rating.

However I notice that for some reason all the votes are getting saved in a database table of field_revision_field_product_rating, and this contains no direct foreign key to the node it is from, is there a 'Drupal' way of fetching the comments in manual SQL with some monster joins?

Just to confirm, review is actually a comment, and the fivestar 'rating' is a field on the comment.

Bonus points: Why, even though I'm using fivestar, are the votes not getting put into the votingAPI storage?

  • load all cid of a node using comment_get_thread.
    – Sibiraj PR
    Feb 12, 2013 at 11:52
  • unfortunately that isn't sufficient as it requires you to supply a limit - which I can never know
    – Dunhamzzz
    Feb 12, 2013 at 12:03

1 Answer 1


On the field settings screen, it is important to set the “Voting target” to “Parent node,” so that these votes will add ratings to the node; then, click the “Save field settings” button

  • This is definitely a step in the right direction, however I've now found that the votes being counted are in correct, for example I have voted with 2 different users on a node, and yet there is only one entry in the voteingapi_vote table and therefore the average is wrong. I have tested this multiple times.
    – Dunhamzzz
    Feb 12, 2013 at 14:12
  • ok after some more fiddling I've worked out the votingapi doesn't like multiple votes from the same user.
    – Dunhamzzz
    Feb 12, 2013 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.