Bear with me, I'm a bit new to all this!

Great module - I notice that it is possible to sort a list of node titles by average vote (among numerous other cool options). However, what I would also really love would be for the possibility of displaying the Fivestar widgets. I may be missing something, but it does not seem possible at present.

For clarity: What I am after is to be able to make a list/table of node titles (as links to the node, which I can do easily with Views), presented with the most highly rated nodes at the top of the list, and the corresponding static average rating widget next to each node title.

Pretty please!?

Many thanks

CommentFileSizeAuthor
#11 sample.jpg18.71 KBgrafsl

Comments

merlinofchaos’s picture

Project: Views (for Drupal 7) » Fivestar
Version: 6.x-2.0-beta4 » 6.x-1.12-beta1
Component: Miscellaneous » Code

Please read the submission guidelines.

quicksketch’s picture

Category: feature » support

Yes, this is totally possible. Create a list of nodes, then add fields for Fivestar. There are options to just display the average vote as a static widget, and a field that let's users click on a rating as another field.

quicksketch’s picture

Title: Fivestar rating widgets as fields? » Display Fivestar widget in Views
geotech890’s picture

Status: Active » Fixed

Thanks quicksketch, I must've missed that one - I guess I have a lot more learning to do with Views!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

Osfer’s picture

Status: Closed (fixed) » Active

Hi all,

Sorry to butt in, but I can't seem to get this to work. Under Drupal 6, with Fivestar 6.12, the latest CCK, VotingAPI and Views, I'm trying to create an image gallery that shows thumbnails (using ImageField) with the star rating beneath them. However, when creating the View, the only fields I can select from are in the VotingAPI Restults and Votes categories. I can get the numerical value of the votes cast to be displayed, but I'd much rather show the average vote value as static stars.

Is this possible? Should there be a fivestar field in my field selector in Views 2?

ajaysolutions’s picture

I think I'm having a similar problem to Osfer. I've got Drupal 6, CCK, Views, VotingAPI and Fivestar.

In Views, I don't have VotingAPI or Fivestar available under fields, filters or sort. I'd like to expose a filter with a star rating, but it's not in the list.

Any clues?

Al,

tanksali’s picture

I had the same problem - no Fivestar/Voting fields under Views. This link helped me get it right : http://skitch.com/eaton/u4xd/votingapi-relationship

Essentially setup a relationship to Voting API and then use the fields that appear for selection. Works well for me. I get a text rating field (80% etc) - need to still figure out how to get the stars in the list I am using this field in.

grafsl’s picture

Voting API 6.x-2.0-beta5 export hook for rendering results. Hook is _votingapi_views_value_formatter(). It's should return array where key is the name of the function and value is the option name, which would be shown in Views (i use Views 2). After you add this hook and go to the your view->Fields->Voting Api results: Value you can see new selectbox with title "Appearance". There your functions would be listed. And you need to create this functions. Function receive $value, $this (link to the handler) and $values.
I did it in this way:

function module_votingapi_views_value_formatter() {
return array('module_votingapi_views_value_static_stars' => 'fivestar static', 'module_votingapi_views_value_number' => 'number' );
}

function module_votingapi_views_value_static_stars($value, $this, $values) {
//output for page
$nid = FALSE;
if ( isset($values->nid) ) {
$nid = $values->nid;
}
elseif ( isset($values->node_nid) ) {
$nid = $values->node_nid;
}
if ( $nid ) {
return fivestar_static('node', $nid);
}
return '';
}

cratos’s picture

Subscribe...

I only get the average value in text, and i tried to implement those hooks that GRAFSL showed us, but had no effect.

GRAFSL have you manage to get the fivestar widget in VIEWS with that coding? Can you please help a little more?

I've put your code in votingapi.module, and then tried to customise in [Site building >> Views], but had no effect...

Thanks in advance.

grafsl’s picture

StatusFileSize
new18.71 KB

CRATOS,

Yes, it's works. But i put this code into my_module.views.inc
Also after adding code i empty cache using Devel module (i don't know if it necessary but i always empty cache).
And after that new drop down appear in 'Voting api: results value' field settings. (see picture)

cratos’s picture

Thanks for the help Grafsl.

I've managed to get the widget with Views2, maybe it was something i was doing wrong.

Thanks for posting your solution.

quicksketch’s picture

I also posted a video on using Views, Fivestar, and VotingAPI on Lullabot.com: http://www.lullabot.com/videocast/building-views-fivestar-and-votingapi

Sounds like this request has generally be satisfied though, so I'm going to mark as "fixed".

quicksketch’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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