PHP snippet to get current node votes

Macarro - September 5, 2009 - 18:33
Project:Voting API
Version:5.x-1.6
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

Hi

I'm using votingapi with fivestar and I'd like to get the current node average vote in a numeric form to do some manipulation with it. Looking inside the module it seems I have to use votingapi_get_voting_result($content_type, $content_id, $value_type, $tag, $function) function but I'm getting nothing from it. The parameters I'm using are:

  • $content_type = 'version' ...wich is right
  • $content_id = NID?... I'm using $node->nid with it but I'm not sure if it's right
  • $value_type = 'percent' since I'd like to obtain a integer between 0 and 100
  • $tag = I don't know what should I use... votingapi?
  • $function = 'average' because I want to obtan the average value for all votes

What should I do to finally get the average value of the votes?

Kind regards and thanks in advance.

 
 

Drupal is a registered trademark of Dries Buytaert.