Even though I allowed anonymous votes in the permissions, those users are not allowed to vote.

Comments

momper’s picture

hello

the same at my site - or is it a wrong configuration?

thanks and greetings momper

hickory’s picture

What error do you get?

justinchev’s picture

I get a similar error when allowing anonymous users to vote via the Access Control. The star rating system shows up but when the anon user selects their star rating it comes up with an error saying they need to register or log in.
Strange thing is the jRating area in Access Control doesn't have any check boxes, but I have set the FiveStar Module to allow Anonymous voting.

See http://www.rankster.co.uk (website currently only set for registered users due to this prob)

justinchev’s picture

Just had a quick tinker and this change seems to work. (Not sure what greater repercussions may be so do at your own risk)

In the file 'jrating.module' I changed the line:

if ($user->uid && user_access('rate content'))

to:

if (user_access('rate content'))

It now allows anonymous users to vote and seems to remember their vote (I presume by IP or something) - though at this stage I'm not sure on the 'vote again' time frame or anything...

justinchev’s picture

DISREGARD THE ABOVE

Stupid, stupid, stupid - posted the above without thinking it through. The change above allows an Anonymous user to post, but the anonymous profile then only counts as one user. ie only one vote.

deezer’s picture

I have same problem. How to solve it?

hickory’s picture

Did you all allow anonymous users to rate content in the jRating section of the Access control page?

If so, and there's still a problem, please describe the error in more detail so I can try and fix it.

justinchev’s picture

Ok not sure how I was getting the error, might have had something to do with the 5star module which I have now switched off. The issue now is...

When you allow anonymous users to vote by setting it via the Access control, an anonymous user can then vote (anon vote1). The problem is that if a second anonymous user then views the item it already registers that there is a vote (as recorded by anon vote1).

If the second anonymous user then casts a vote it just overwrites the 'anon vote1' and still counts it as only 1 vote. It doesn't give the second anonymous user a blank vote.

If you view this link you will see what I mean with the top item already having an anonymous vote cast, where it should be blank for the new anonymous user. http://www.rankster.co.uk/arts-crafts

hickory’s picture

justinchev: Anonymous users are counted as the same person if they come from the same IP address within 24hr. Is what you're seeing incompatible with that?

Does the second anonymous user see the first anonymous user's actual rating, or just that there's been a vote? (which there has, so you'd expect that)

justinchev’s picture

The second anonymous user I tested with was coming from a different IP - see this link (http://www.rankster.co.uk/arts-crafts) The top item will already have a vote cast for anon users.

hickory’s picture

That's strange. The actual code is

$hostname = $_SERVER['HTTP_X_FORWARDED_FOR'] ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$rating = db_fetch_object(db_query("SELECT value FROM {votingapi_vote} WHERE content_type = '%s' AND content_id = %d AND value_type = 'percent' AND tag = 'vote' AND uid = 0 AND hostname = '%s' AND timestamp > %d", $content_type, $content_id, $hostname, time() - (60 * 60 * 24))); // existing vote from the same IP address within the past day

Could you look in the database and see what values have been stored in the votingapi_vote table for the anonymous votes on that item?

justinchev’s picture

One quick thing... I have just noticed in the jRating configuration I had everything set to YES apart from the 'Display rating form for anonymous users' which was set to NO. Should it still be showing? Have now changed this to YES, not sure if that will make a difference.

Will try and check what is in the database, not my area of expertise so holding thumbs...

Another thing is I am using 5.x-1.x-dev, should I update this as it may be something to do with that?

hickory’s picture

As long as you have the -dev version from today (yesterday's might be ok too) it should be alright - it's automatically packaged from CVS daily.

If you're allowing anonymous users to vote then the form will be shown regardless of the other option, which is for displaying the form even when anonymous users aren't allowed to vote (it gives the 'login or register' message when they try and vote).

justinchev’s picture

Just looked in the database for that item and there are fields for vote_id, content_type, content_id, value, value_type, tag, uid, timestamp, hostname - not seeing any reference for anonymous.

hickory’s picture

There will be some votes stored in that table with content_id = 479. At least one of them should have uid = 0.

justinchev’s picture

Yeap there is one with a uid = 0.