I have a view that displays the voting widget that is associated with a node type using the "VotingAPI percent vote result" field.

In the view the permissions are ignored and the widget allows votes to be made. I assume that it should not allow votes and display the static widget if the return of user_access('rate content') is false.

Comments

quicksketch’s picture

Title: view permissions » Check "rate content" permission in views

Thanks, this indeed sounds like a bug.

CoolDreamZ’s picture

I have the same issue using the Bonus Grid view with a widget embedded in each grid cell. It gives the appearance of a vote for an anonymous user (which is not actually saved as far as I can see)

CoolDreamZ’s picture

An update on this, the widget also displays even if Fivestar is not configured for the related content type

leenwebb’s picture

Subscribing -- I have this same issue; I'm displaying "VotingAPI percent vote value" in my Bonus Grid view, and even though I have fivestar set to never allow anonymous voting, it's letting anonymous users vote.

(I think that's it not actually saving the vote, but I want it to have the same behavior it has on the actual node page -- to just display the votes thus far and not show any rollover behavior at all.)

leenwebb’s picture

In the spirit of trying to make developers cry, I'm posting my hack-tastic workaround for this bug. It is gross, but it works!

In fivestar.module, down way at the bottom around line #1510, I edited the two functions "fivestar_views_widget_compact_handler" and "fivestar_views_widget_normal_handler" like so:

function fivestar_views_widget_compact_handler($op, $filter, $value, &$query) {
	global $user;
	if($user->uid == 0){return fivestar_views_value_display_handler($op, $filter, $value, $query, FALSE);}
	else { return fivestar_views_widget_handler($op, $filter, $value, $query, FALSE);}
}

Ouch. My anonymous vote interval is "never", which is functionally equivalent to being logged in (AKA having a UID of something other than 0). I couldn't figure out how to grab anonymous vote interval, so I grabbed $user instead.

If a user is logged in, they get to vote. If the user isn't logged in, they can see the stars but can't vote.

I was desperate to use Fivestar in some views, so if you are too, feel free to use this code. Hopefully before too long a Fivestar developer will come up with a real solution and save me from myself.

quicksketch’s picture

Version: 5.x-1.12 » 6.x-1.13
Status: Active » Fixed

This has been fixed in both the Drupal 5 and 6 versions of the module, it'll be included in 1.14.

D6: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/fivestar/fi...
D5: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/fivestar/fi...

Anonymous’s picture

Status: Fixed » Closed (fixed)

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