Get updates and news:
Want to get Lullabot article, videocast, and podcast announcements delivered right to your in-box? Let us know your email address (we won't share it) and we'll let you know when anything exciting happens.

Subscribe to our weekly audio podcast, our periodic videocasts, or both. Just choose your favorite podcast-listening application or service and click away!


Building Views with Fivestar and VotingAPI

Drupal version: 6.x

This videocast covers three modules, wrapped together to provide a flexible solution for displaying information about content ratings in a list.

VotingAPI: Central storage of votes and rating information.
Fivestar: A flexible widget for registering votes on a 1-10 star basis.
Views: The ultimate Drupal query builder, capable of pulling out lists of information from the database.

In Drupal 6, the options in configuring views has become drastically more complex. This videocast helps understand how to setup views that display information about the current average rating for piece of content and also how to pull in an individual users results, each displayed as Fivestar widgets.

Comments

Nice tutorial

Nate

Awesome stuff. I'm finally on the way to Views nirvana, so thanks for this really neat presentation

Fixing the preview problem...

<?php
function fivestar_init() {
  if (
arg(0) == 'admin' && arg(1) == 'build' && arg(2) == 'views' && arg(3) == 'edit')) {
    ...
add css here...
  }
}
?>

Great Tutorial!

Thanks for showing us this, Nate. I'm pretty sure I'll be doing this in a site very soon, and this was extremely helpful.

Voting API arguments

Hi Nate,
Thanks for the great videocast. These stuff is really needed to level up a lot of people's understanding about Views.
I have a question, though. I wondered of it would be possible to have UID's as arguments for your view, so that you could filter on the individual nodes that were cast.

Assume our view is displayed on the path "votes". The path "votes/2" would give the table that you made, but only displaying the votes of the user with UID 2.

Voting API doesn't seem to introduce arguments by itself. But is a work-around possible?

Thanks,
TUc

I need help to open this MP4 video.

HI, all,
I tried to open this mp4 video using QuickTime and Realplayer. I can listen but I failed to watch this video clip.
Do you have the same problem?

Thanks for helping me out.
Tony

I need help to open this MP4 video.

HI, all,
I tried to open this mp4 video using QuickTime and Realplayer. I can listen but I failed to watch this video clip.
Do you have the same problem?

Thanks for helping me out.
Tony

Two for One

Two great tutorials in one Views and 5 Star.

I been struggling with views for D6, you have just solved two problems for me.

Thanks very much

Ron

The video is not playing in full....

The video stops after 1/4 of it's full length. Please, I need to se the whole thing...

Lars

great screencast - just one

great screencast - just one problem, i do not see the node relationship when i am creating the view. It does not show up in the filter list. I have followed the instructions carefully and have looked for modules that may be missing, but all seems right. I am running on drupal 6.5. views 2, voting api/fivestar (latest).

please help.

thanks

nevermind. i figured that i

nevermind. i figured that i needed to use views2 rc2.0 +

Views showing each individual vote when logged out

When I am logged in, everything is working just like the tutorial, but when I log out and go to the page generated by the view, or if an anonymous user visits the site, every individual vote is shown. The votes are grouped together by the title, and the order seems correct, but instead of just showing the average, every vote is shown. This seems to be the same whether I use "Voting Results" or "Individual Votes" relationship. Any ideas?

Thanks for this post

...don't know for how many hours I've been struggling without a relationship. Thanks for making things so clear so easily! Cheers!

You saved my life!!!!

I was seriously going mad trying to weed through the new Views interface to get the votingapi and Fivestar to do their thing. It's crazy that something as simple as mentioning that you now need to create a relationship for this to fall into place wasn't. I'm sure there are plenty of people just like me trying to scan through the 50 billion useless, outdated and repetitive posts gather by Drupal.org search.

Anyway thank you so much for clearing this all up for me. Maybe there should be some way to tie amazingly enlightening videos like yours to the module project pages on Drupal.org and vise-versa. I'm sure the support requests would drop substantially and create more confident webmasters more willing to dive deeper into Drupal .

great tutorial

This is will please so many readers. Thanks for it.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h2> <h3>
  • Lines and paragraphs break automatically.
  • Use <!--pagebreak--> to create page breaks.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options