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 bi-weekly audio podcast - The Lullabot Drupal Podcast, our daily interview snippets - Drupal Voices, our periodic videocasts, or everything. 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?

Same problem

I have the exact same problem, when logged out, I get duplicates of the rated content. AND also the "My rating" column, i.e. the column where the user can rate the content, is already pre-populated with a rating! I guess this has to do with having multiple uid's with the value 0 in the db.

Anyone has a solution for this?

Same problem

I have the exact same problem, when logged out, I get duplicates of the rated content. AND also the "My rating" column, i.e. the column where the user can rate the content, is already pre-populated with a rating! I guess this has to do with having multiple uid's with the value 0 in the db.

Anyone has a solution for this?

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.

video is not playing full

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

Great tutorial

Many thanks, really clear, helpful and time saving!

Great! Thanks for this! But

Great! Thanks for this!
But one more question, what if I want to show results not in stars? I wana show result in a poins (like 3.5, 3) like in view editing page, how to do this?

Views fields - seperate your vote and average vote

I would like to separate the tally for "your vote" and "average vote + number of votes" into separate fields in views. Any idea how to do that?

listing of everyone who voted, and what they voted

To add to this previous request, how can we get a listing of everyone who voted and what they voted?

In my case, it is for a spreadsheet where a small group of people are rating applications to a conference workshop. I want to know what everyone voted, not just the average.

A big thanks from the UK

Hi,

Just wanted to say a big thanks to Nate, Addison, Kent (And the rest of the team) for providing the videocasts.

I am just about to start on my second drupal site and your tutorials are proving invaluble.

Thanks again

Luke

Thanks for this

I just wanted to say thanks for this screencast. I finally got around to watching and it makes Views so much clearer.

I'm reading Using Drupal right now and it's exactly the Drupal book I've been waiting for as well. These kind of examples are the perfect way to help people unlock Drupal.

Thanks again!

Great tutorial and all was

Great tutorial and all was perfect until I created a View with filters, but when a filter is used the filter results do no show the stars of Fivestar as the initial page does, just the non css widget? Why is this? Thanks

Turn off Use Ajax

The error was caused by the Use AJAX on the basic setings being, on, turning it off and the stars where there

QT stopped

i downloaded latest version of QT for windows but the video also froze quarter of a way through.

Great tutorial

Just wanted to say, this was a great tutorial, helped me get exactly what i as after, great job and thanks a lot!!

Ben.

Fantastic, thanks!

As a Drupal newbie - just a few weeks in - there's no way I could have figured out all these details on my own. I was pretty frustrated that the rating didn't show up in my view after following a simple procedure that I had thought would work. (This turned out to be way more complicated than I would have ever dreamed.) After following your step-by-step procedure, though, mine works great - thanks a bunch!

Grant

Great no-nonsense videocast

and the 'using Drupal' book is great. I'd love to see volume 2 of this book with more test cases.

suppose I am not a windows

suppose I am not a windows or a mac user.
there is no actual way to see this video without losing 2 hours of my life trying to figure out how, right?

anyway... thank god my MOTHER has a computer that runs WINDOWS otherwise I would kill myself.

seriously, you guys have the most precious tutorials and the worst way to serve them...

it's a pitty.

m.

This is just what i was

This is just what i was looking for! GREAT tutorial, thanks for the help!!

List of recent revies of certain node types

I am struggling to build a recent reviews view.

I am trying to clone the default recent/comments view, and then limit the noe types to

hotel, school., and add the fivestar widget.

see this picture http://i44.tinypic.com/2dl28h2.jpg

Thank you

Many Thanks!

this was great. Thanks so much!

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