Specific need: I would like to provide ability for anonymous users (despite the same IP address and without authentication) to give their opinion on specific product, by calculation of total votes and average voting results. Preferably in one widget, but it may be done in two of them - one representing results, the other - current viewer/user action to input his/her own vote.

Background: I am developing solution to rate specific content [type] (contain product description - not any e-commerce product, just custom content type), providing such possibility for Anonymous users. I intend to utilize Fivestar or Rate modules (hope this is not so much a difference, as both modules depend on Voting API for calculation of results). Voting for Registered/Authenticated users in this case is not going to be produced. Preferable result - public site with product description with displayed already existing public ratings for specific product, as well, as possibility to input new opinion by rating the product.

I started to test Voting API settings (with Rate module), particularly "Anonymous vote rollover" settings, which seems to be not doing the job right, or I do not understand specifics, as votes tend to rollover all the time, despite settings change.

To re-create:

  • I installed Voting API module, and afterwards Rate module.
  • In Rate module, I create voting widget from provided fivestar template.
  • Output of the widget is provided by custom ...tpl.php file for specific content type via the following code:<?php print $node->content['fivestar_widget']['#value']; ?>
  • I was checking database table content after each vote for votingapi_vote table.

Case1:

  • Anonymous vote rollover: Immediately
  • Vote tallying: Tally results whenever a vote is cast

Case2:

  • Anonymous vote rollover: Never
  • Vote tallying: Tally results whenever a vote is cast

Up to my understanding, these settings should produce different results, where:

  • If there is Immediately available rollover, next vote from anonymous user should be overridden immediately;
  • If Never is selected in these settings, no new votes from the same IP address should be registered.

Upon settings mentioned above, I do not consider, that cron recalculations or Caching (if potentially enabled in production version) should not be taken into account. More over, after each session of voting, I completely close browser, set to clear browser cache on close, and opening new clean product page, considering, that it would be new session for browser too, and in hope, that dependance is upon IP address only. (Unfortunately, testing from the same IP address seen by the server - not local machine development).

RESULT: Despite change of settings, each time another vote from the same machine (IP) is run, there are changes to the database table giving the last voted value. The only thing which changes is vote_id, value (result of the vote) and timestamp.

I can not achieve none of the following:

  • Restrict anonymous voting result from the same IP address if rollover is set to Never, e.g. vote value is changing despite such restrictions.
  • If still there are no restrictions for voting from the same IP, I can not achieve collection of several votes from the same IP, to calculate average vote (if they might be different). E.g. voting action from the same IP results in changing previous results from the same IP, but not adding additional vote as such with different result from previous.

Kind of an issue may be the fact, that I am logged in as user 1 on other browser on the same computer/IP. But still such things produce different browser/cookie sessions (the last not implemented in settings.php yet).

The second question: is there and availability to show average results on voting widget, while viewing node, and still provide own voting on the same widget, or I have to manage that separately - results and voting actions in two widgets (probably this may be specific widget related module's issue).

Can anybody help me in achieving intended functionality, or at least point me to right direction in understanding custom Voting solutions. I do not mind some coding, although, I'm not a programmer, and relay heavily on Drupal modules and slight theming functions in template.php

Comments

OFF’s picture

How to set restrictions on cookies for voting from same ip?

OFF’s picture

Version: 6.x-2.3 » 7.x-2.12