Using the Drupal 6 Fivestar module with Views

If you're using the Fivestar module for Drupal you'll probably at some point want to use your ratings within a View. Assuming you're enabling the Fivestar rating against the content type as opposed to via a CCK field then you'll need to include it in your View via a relationship in order to display it with the associated node. The following instructions are for achieving this in Drupal 6 (I expect the process is similar in Drupal 7, but I haven't yet tried this).

From your node View add the "Note: Vote results" relationship to the view by clicking on the small "+" icon next to "Relationships" and select "Node: Vote results" (you can filter the list by selecting "Node" from the "Groups" dropdown).

Screenshot of the Views relationship and field settings

In the relationship configurations panel use the data filters to ensure that the results of the Fivestar module are correctly exposed. Set the value type to "percentage", vote tag to "normal vote" and use the "average vote" for the aggregate function; these ensure that you don't end up with duplicate nodes being output as rows (I had some issues with this being the case to start with).

Views Fivestar relationship settings

To add the Fivestar field, just add the "Vote results: value" field to the View's fields. From the field configuration options you can set how the results are displayed using the "Appearance" dropdown; I tend to select "Fivestar Stars (display only)". Make sure that the field uses the "Vote results" relationship that you created.

Field configuration

Your View should now include the Fivestar results with your output nodes. 

Related Content

Published on


  1. Alessandro Siletto |

    I was starting editing template files then i found your blog!

    Nice tutorial!