Hello,
Just installed a website based on drupal 6.2 for a photographic contest.
I needed a way for my users to rate images uploaded using the image module, and installed fivestar and votingapi. Now I'd like to use vews to make a list of highest rated shots.

I read in the README that in Views I have to select "VotingAPI percent vote result" from the list of
available Fields, but this field simply isn't there, nor I find anything about fivestar or voting in the available fields... maybe I missed something, but what?

I'm using:
drupal 6.2
views 6.x-2.0-beta4
votingapi 7.x-2.0-beta6
fivestar 6.x-1.0-alpha2

Comments

vm’s picture

Status: Active » Postponed (maintainer needs more info)

votingapi 7.x ? you should be using votingapi 6.x. please double check

quicksketch’s picture

The new Voting API (6.x-2.0-beta6) breaks the views integration with the current version of Fivestar. I'm releasing a new version soon. Until then, use the beta5 version: http://drupal.org/node/267356

The README also probably needs to be updated, as the field names have changed in Drupal 6.

drupaloSa’s picture

Beta6 allows to select the appearance of vote display via a select box. How can i do this in beta5? Is there a way to display stars instead of just the percent value?

drupaloSa’s picture

Status: Postponed (maintainer needs more info) » Active

The problem is partially solved by using 6.x-2.x-dev (8th July), however the display of ratings do not follow the settings made for that content type. I mean i have a custom node type which i can rate from 1 to 10 but the view uses stars from 1 to 5.

capellic’s picture

I Need this, too. I took heed, backed out of beta6 and went for beta5. I see the following fields available but how do I display the little voting widget?

VOTING API RESULTS

Voting API results: Function - The aggregate function used to calculate the result.
Voting API results: Tag - An optional tag to group multi-criteria results.
Voting API results: Timestamp - The time the results were calculated.
Voting API results: Value - The value of an individual cast vote.
Voting API results: Value type - The nature of the results in question (points, percentage, etc).

VOTING API VOTES

Voting API votes: IP Address - The IP address of the user who cast the vote.
Voting API votes: Tag - An optional tag to group multi-criteria votes.
Voting API votes: Timestamp - The time the vote was cast.
Voting API votes: User - The user who cast the vote.
Voting API votes: Value - The value of an individual cast vote.
Voting API votes: Value type - The nature of the vote being cast (points, percentage, etc).

capellic’s picture

I started to muck around in fivestar.module to see if I could pass in an ID and get the widget form back. was able to successfully implement a "ready only" version of the rating. In my views-view-fileds--vendors.tpl.php (where 'vendors') is my view name, I enter the following:

fivestar_static('node', $fields['nid']->content);

It returns the stars and "Your rating..." underneath.

I see that there is the following function:

fivestar_form(&$form_state, $content_type, $content_id)

But I don't know what to enter for $form_state. I gather that, in my case, $content_type will be 'node' and $content_id will be $fields['nid']->content.

drupaloSa’s picture

So there isn't a way to display the correct configuration without custom theming the view?

capellic’s picture

Check out this post on this thread:

http://drupal.org/node/297635#comment-972021

You will see my followup comment stated some hesitation, but after I upgraded to beta6 and also upgraded to the most recent dev version of FiveStar (very important for avoiding an AJAX JS error), I followed his screenshot and it worked.

The latest version of FiveStar isn't available on the module page, instead you can get it here:

http://drupal.org/node/286329

drupaloSa’s picture

I'm already using the latest dev versions for both modules. My problem is that although i use a 10-star rating system, views displays a 5-star rating. Does this work for you?

capellic’s picture

I haven't tried 10 stars - I am using 5 stars.

misterlawrence’s picture

I am happy to start my own thread if necessary, but I thought I would start by piggybacking on this one since it is such a similar issue (perhaps the solutions are also similar).

I am on Drupal 5.10, Fivestar 5.x-1.13 Voting API 5.x-1.6 and Views 5.x-1.6.

I have a table view of products (books, CDs, video games, etc.), and each one has been individually rated in Fivestar by users. Last year, I was able to display the Average Fivestar rating (in "stars") on each row of the table. I recently updated to the latest versions of all the code listed above, and now there are no Fivestar fields available for using in the table View.

Can anyone offer any suggestions?

quicksketch’s picture

misterlawrence: select "Voting API User Average" as the field, then choose "As Stars" as the display option. Fivestar moved from providing it's own Views integration to leveraging the code provided by VotingAPI.

misterlawrence’s picture

Thanks quicksketch. That was really helpful!

Unfortunately, the closest field names are "Voting API Precent Vote User" or "Voting API Percent Vote Result (Average)". Neither seems to give the appropriate result. The first one does not have any data displayed (nor does it have any Fivestar options). The second one seems to show five stars for every listing (which is not correct data).

Any further ideas would be appreciated.

Thanks!

-David

misterlawrence’s picture

Bump. Any help on the my question above would be appreciated. Thanks!

misterlawrence’s picture

StatusFileSize
new39.27 KB

For clarity, I've attached a small jpg screenshot of the Views options that I have available for Voting API. Are any of these choices the correct one to use? If not, is there a different version of Fivestar or VotingAPI that I need to install?

virtualdrupal’s picture

I have the same issue, tried the latest DEV of votingAPI and of FIVESTAR, still nothing, the latest DEV of views seems to remove ALL votingapi options... Any ideas?

I'm basically switching to D5 at this point just because having fivestar work within a view is imperative for this project, however now D5 is proving to be just as troublesome, now views1 has the option for fivestar/clickable, but I can't figure out how to theme out the results :mad:. The D6 ability to setup a views-view-fields.tpl.php and theming each

print $fields['title']->content;

of course isn't an option in D5 that I can find..

So unless fivestar becomes clickable within a views2 output, life isn't going so well :(

If anyone could please contact me when they have a few minutes I'd really appreciate it, I just keep going in circles

quicksketch’s picture

Views2 recently changed it's API between RC2 and RC3 (sigh), so you'll need to update to the latest VotingAPI version to get everything working again.

quicksketch’s picture

Use the latest versions of Fivestar, VotingAPI, and Views and things should be working again. To clarify, any of the following versions of these modules should work together:

VotingAPI: 2.0 RC1 or higher
Views: 2.0 RC2 or higher
Fivestar: 1.13 or higher

To get comfortable using Views in Drupal 6, this screencast should help: http://www.lullabot.com/videocast/building-views-fivestar-and-votingapi

meba’s picture

I can't confirm this. I am using:

VotingApi 2.0 rc1
Views 2.0 RC4
Fivestar 1.13

and no fields are in Views form

meba’s picture

Please disregard my message, I didn't know it's relationship...

chasz’s picture

what is its relationship?

capellic’s picture

If you are familiar with MySQL, then a Relationship is a Join. It allows you to essentially relate another table to the table you are already looking in by a similar field (a key).

This screencast came out soon after I figured it out - it should answer a lot of questions:

http://www.lullabot.com/videocast/building-views-fivestar-and-votingapi

Lars69’s picture

I have been trying to find my "Voting API field" for a frantic couple of days now. The above screencast will not play more than 1/4 of its length, and I can't find any other source of information on this subject than this thred. I'm using "quicksketch" req. versions of modules. Is it only me who can't se the full screencast?

(My problem is that I use views formated for tables output and can't make fivestar working, and I can't find the Voting API field...)

Lars69’s picture

Found the answer learning about relationships in views. Very complicated but works. Thanx.

Again, all answers here:

http://skitch.com/eaton/u4xd/votingapi-relationship

justinchev’s picture

Check out this post - I describe how I went about adding the 'Sort by 5 star' view for my site. Also had some problems when it came to the various releases of various modules. Once I had the 2 troublesome modules updated to the latest version all problems were resolved.

http://drupal.org/node/310310

quicksketch’s picture

Status: Active » Fixed

I've put the link to the Lullabot Screencast on the Project homepage. Hopefully this will reduce the confusion regarding creation of Views with Fivestar and VotingAPI. I think everyone's had their question answered, so I'm moving to fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

zenrei’s picture

Version: 6.x-1.12 » 6.x-1.18

I'm assuming because everything's upgraded, it all works differently, or not at all now?

zenrei’s picture

Status: Closed (fixed) » Needs review
vm’s picture

Status: Needs review » Closed (fixed)

works the same way

zenrei’s picture

I don't see how, because the entry names are different, and it's not pulling in the stars, only words.

I'll try again, from scratch, though.

jghyde’s picture

StatusFileSize
new357.35 KB

The answer to include fivestar in views, without a screencast, is:

  1. Assumptions:
    • You are displaying Fivestar ratings that were voted on the node, whilst viewing the node, from the widget on the node's page
    • Fivestar 6.x-1.19
    • Voting API 6.x-2.3
    • Content Construction Kit (CCK) 6.x-2.6
    • Views 6.x-2.10
    • Drupal 6.16
  2. Configure the Fivestar options on the /admin/content/types/add (or [edit] an existing content type)
  3. Optional Go vote on some nodes. Use the http://drupal.org/project/devel module to mass-create some users, log in as those users, and make some random votes.
  4. Create or edit the view in Views where you want to display the votes.
  5. In Views edit panel, center column, top, titled "Relationships," choose (by clicking on) the "+" sign and add "Node: Vote results"
  6. Save the view
  7. In Views edit panel, center column, bottom, titled "Fields," choose (by clicking on) the "+" sign and add "(Vote results) Vote results: Value"
  8. Save the View again
  9. Check your work by displaying the view preview
  10. Theme away

Thanks to @capellic for the link, http://skitch.com/eaton/u4xd/votingapi-relationship that explained it all for me (and gives you a graphic of these instructions), I attached a screenshot of my Views panel after configuring Fivestar module to show in the View.

gawas.sachin’s picture

Add Fields-> voting Results -> Choose Appearance -> Default/Fivestar Text And You are done..!

SeanA’s picture

Title: How do I use fivestar with views? » How to display Fivestar rating with Views
Version: 6.x-1.18 » 6.x-1.19
Status: Closed (fixed) » Active

Setting to active because this is useful documentation, and it's not obvious how to get this working.

@jghyde: Thank you for the simple (text-based) explanation!

janroche’s picture

Issue summary: View changes

@gawas.sachin I'm using the latest Drupal version 7.x I can't seem to find the how to use the default fivestar for the appearance. All it shows is digits instead of image stars. How do you easily show the image any ideas?
I'm not searching

intelviji’s picture

I set up five star module in views successfully. by setting up a relationship with voting results. Now, It casts vote correctly. But, i want to reply "Thanks for Voting" after successful vote.

whiteph’s picture

Status: Active » Closed (won't fix)

Sorry, Drupal 6 is end of life, and is no longer supported.

SeanA’s picture

Status: Closed (won't fix) » Closed (fixed)

Actually, this was answered and can therefore be marked "fixed". See #32. I only re-opened it so others could find the answer easily.

whiteph’s picture

@SeanA - thanks.