I have created content that is user definable using exposed views filters. It works great and allows for a real drill down of shown content for the user using taxonomy and CCK taxonomy fields.

However I cannot see a feasible way to add Fivestar to the exposed boxes for the user. I want them to be able to add to the filter on highest and lowest node ratings but because the module is using a Handler for votingAPI i can't get that in the exposed filters box for the users, so they can't use it to sort this way.

Anyone any ideas if theres a workaround ?

Also how do i get fivestar to show up as selectable or at least show no votes image in teaser view using views ? I have it where it shows the rating when someone rates within the node (although this isn't selectable) but doesn't show anything in teaser view if no rating was or has yet been applied.

Hoping someone can help.

Comments

WISEOZ’s picture

Adding my support to this request ...

Fivestar needs an Exposed Filter that displays the actual voting selections, "Good", "Bad", "Poor", etc. The Exposed Filter feature for "VotingAPI percent vote result" just isn't user friendly.

ajaysolutions’s picture

I'm using Drupal 6 and have just installed the Fivestar module and want to expose it using Views for users to filter content (to show only 4 or 5 star for example).

A quick Google brought up this thread, so I presume as I can't see it available in the Views filter and this is still an open thread, this is an outstanding request.

It would be mighty handy!

Thanks,

Al

quicksketch’s picture

Version: 5.x-1.7 » 6.x-1.x-dev
Category: support » feature

Moving to feature request.

green monkey’s picture

Thank you considering this, it will be very useful

Will you also consider adding a not rated or "0" to this filter?

5
4
3
2
1
0 <---- this will allow us to find and monitor not rated yet nodes. (but I'm not sure sure if you actually store a zero --- it's probably "blank" ?

thanks

cybershan’s picture

Subscribe, waiting for this new feature.

daneyuleb’s picture

Subscribe

navs’s picture

subscribing

Ghostthinker’s picture

Subscribe

El Bandito’s picture

Subscribe.

Cheers

mdowsett’s picture

subscribe

nbourdial’s picture

subscribe ! I need this feature too.

FuXXz’s picture

subscribe

Anonymous’s picture

me too

dreipunktnull’s picture

subscribe

ltwinner’s picture

This is exactly what I'm looking for. Would an excellent addition to the module.

merilainen’s picture

+1 for this feature

igorik’s picture

subscribe

Anonymous’s picture

Two years and no solution or am I looking in the wrong place?!

guygg’s picture

Yes, this would be mighty nice to be able to do.

nicktech’s picture

Subscribing

sahuni’s picture

It's not possible, even for fivestar cck field?

glitz’s picture

subscribing

lsdoc77’s picture

Subscribing

Docc’s picture

subscribe

mngm’s picture

Subscribing! Really need this!

sreher’s picture

subscribe

YK85’s picture

+1 subscribing

jbenfield’s picture

me 2. This would be fantastic and would provide what seems now to be a fairly common website functionality.

Annie Rothenberg’s picture

subscribe

patrickroma’s picture

subscribe

glenshewchuck’s picture

subscribe

BeaPower’s picture

any progress?

marcoka’s picture

subscribe

BeaPower’s picture

news?

j.helmer’s picture

Subscribing!

Been almost 3 years since this post was initially brought up. I am quite surprised more people don't need this!

It seems that in this day-and-age, people would have more clients asking for rating systems, and would like to use views filters.

In any event, what is the level of effort to get better views integration for fivestar? I need it for a client.

VictorMYeste’s picture

I don't know if this can be helpful to someone, but I recently discovered that the REAL vote is rated in 0-100.

So, for example, if you want to exposed a "greather than or equal" (Min) and a "less than or equal" (Max) values of Fivestar and you want to show nodes rated with seven stars, put 70 in both and you get it. Or if you want nodes rated between 5 and 8 stars, put 50 at Min and 80 at Max and it's done.

If you explain all of this to the user, you can have an exposed filter for fivestar. It's not the perfect solution, but... it's the best i have obtained.

jerry’s picture

For folks still looking for a solution to this, a study of the Views issue queue yielded this one. It uses the form alter hook to modify the exposed filter form to employ a select list, providing a way to supply the percentage values with more user-friendly labels.

Toxid’s picture

That's a very good solution, jerry. I just got one problem, if I remove the query information from the url (the &value=0 information), then the view will not load and gives me this error "An illegal choice has been detected. Please contact the site administrator.". I got no idea how to solve that, even after reading alot in the views issues queue. It seems that the default value for the select list is not set in $form_state. It could be the culprit.

jerry’s picture

That problem was reported here in the Views issue; the solution follows in the next response.

My own version looks like this:

/**
 * Implementation of hook_form_alter().
 *
 */
function xxx_form_alter(&$form, $form_state, $form_id) {

  /* Modify the exposed Views filter forms for school searches */

  if (($form_id == 'views_exposed_form') &&
      ($form_state['view']->name == 'school_list')) {

    /* Change the exposed filter for FiveStar ratings to a select list */

    if ($form_state['view']->exposed_form_id == 'views-exposed-form-school-list-page-2') {

      $form['rating'] = array(
        '#type' => 'select',
        '#options' => array('' => t('<Any>'), '20' => '*', '40' => '**', '60' => '***', '80' => '****', '100' => '*****'),
        '#default_value' => '',
      );
    }

  /* Additional form alterations omitted */

  }
}
Toxid’s picture

Thanks jerry! Although the thread you linked to didn't help me much, your code did. The only difference in my code was that I had set the default value to 0, figured that everything equal to or above 0 could represent the - Any - value. When I changed this value to '' then everything works without problems :-)

BeaPower’s picture

Where do I put this code?

jerry’s picture


Where do I put this code?

The code is an implementation of a Drupal hook, so it needs to go into a module. It's very simple to create and install such a module - you essentially drop the code into a file called your-custom-module-name.module, and create a matching your-custom-module-name.info file with a few lines of descriptive text. The process is described here for Drupal 6, and here for Drupal 7. If you're not comfortable with doing this yourself, you may be able to use the Module Builder module to help guide you.

ayesh’s picture

May be nobody is looking for such feature but I tried #39 and it worked!
For Drupal 7, change this line:
if ($form_state['view']->exposed_form_id == 'views-exposed-form-school-list-page-2') {
to this:
if ($form['#id'] == 'views-exposed-form-school-list-page-2') {

ugers’s picture

If you're looking for a way your users can sort the content by rating, you can add rating in the sort criteria and then expose it. It will appear in the exposed filter widget area and there the users can sort either ascending or descending (can be renamed to e.g. most popular)

stewart.adam’s picture

People looking for this functionality should apply the patch from #1255160: Add better views filters for star ratings, works out of the box!

whiteph’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

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