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
Comments
Comment #1
merlinofchaos commentedPlease read the submission guidelines.
Comment #2
quicksketchYes, 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.
Comment #3
quicksketchComment #4
geotech890 commentedThanks quicksketch, I must've missed that one - I guess I have a lot more learning to do with Views!
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #6
Osfer commentedHi 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?
Comment #7
ajaysolutions commentedI 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,
Comment #8
tanksali commentedI 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.
Comment #9
grafsl commentedVoting 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 '';
}
Comment #10
cratos commentedSubscribe...
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.
Comment #11
grafsl commentedCRATOS,
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)
Comment #12
cratos commentedThanks 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.
Comment #13
quicksketchI 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".
Comment #14
quicksketchComment #15
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.