Hi,

i needed to implement the checking of the users session-id instead of his ip-address to prevent multiple votes. in the attatchement you'll find the patches. feel free to review and use it.

One thing before you start: you have to patch the advpoll module and the votingapi module to make it work. both patches are available in the attatchment.

Regards - Andreas

CommentFileSizeAuthor
#4 advpoll.patch.new_.zip11.41 KBambo
advpoll.patch.zip7.06 KBambo

Comments

Marat’s picture

Hi andymob,

This is a great idea. If I vote using one PC at my school, all other PCs in my school will not be able to vote since the School IP address has already used by me for this poll. Another example, we are four brothers using the same internet account at home but different PCs. When one of us vote, the rest will not be able to vote and so on.

It seems to me your idea overcomes this limitation. I tried it but it does not work with me, I am not sure what is the wrong. Do I need to uninstall and reinstall the advpoll module to get it work?

Thank you

xliu’s picture

Category: feature » bug

Thank you for writing this patch! But I am having trouble getting this to work too.

I patched both votingapi and advpoll, then disabled both module and re-enabled them. When I try to create new polls, everything shows fine in preview, but after I submit, none of the poll content will show up in node page. And when I try to edit the node, the poll setting got reset to default.

Is there something I missed?

xliu’s picture

Okay, It seems that if you've already have the modules installed, you need to manually add a column in the advpoll table as the change file for advpoll.install.patch stated.

Now my polls are showing. But here comes more problem... The control by cookie thing doesn't seem to work.

I set my poll to prevent multiple votes by cookie. After I vote as visitor, once I refresh the page, the choices are shown to me again. It doesn't matter if I clear the cookies and cache, I can vote as visitor as long as I do not vote for the same selection. Also, it doesn't matter if I clear the cookies and cache, once a visitor have voted for one selection, no other visitor's vote on that selection counts any more. So my vote result page shows something like this:

12.345.678.900 option A
191.345.678.900 option C
12.345.678.900 option B
12.345.678.900 option D
xliu option B

Need some guidance here. Thanks!

ambo’s picture

StatusFileSize
new11.41 KB

Hey,

first of all: yes, you have to disable and enable the module if it is already in use. therefor i patched the install script. but as xliu said you can also do the changes in the database manually.

xliu your problem sounds strange, I'll look at this soon. Did you have a URL for me?

regards - andymob

edit: it seems that i uploaded an incomplete patch lasttime. the binary.inc.patch was empty... sorry for that. please use this one and update your binary.inc file for the use of that cookie-based authentication. this should be solving that issue...

xliu’s picture

Yes! The binary.inc patch did it! Everything is working as desired now.

Thank you so much, Andreas! Awesome patch!

xliu’s picture

Category: bug » feature
ChrisKennedy’s picture

Status: Needs review » Needs work

This looks pretty close, thanks for working on this!

If you have time, it would be helpful if you could post the advpoll-related changes as a cvs-based .patch file rather than a zip with multiple files. Then create a separate issue for voting api with its own cvs-based .patch file, although you need to be more specific about what version of VotingAPI you are patching.

On the advpoll end this patch needs a database upgrade function in advpoll.install, which would be advpoll_update_9().

ChrisKennedy’s picture

This looks pretty close, thanks for working on this!

If you have time, it would be helpful if you could post the advpoll-related changes as a cvs-based .patch file rather than a zip with multiple files. Then create a separate issue for voting api with its own cvs-based .patch file, although you need to be more specific about what version of VotingAPI you are patching.

On the advpoll end this patch needs a database upgrade function in advpoll.install, which would be advpoll_update_9().

ambo’s picture

Hi Chris,

thanks for your advices, I'll try to get this between the years.

Regards - Andreas

danmuzyka’s picture

Hi Andreas and Chris,

Are there plans to migrate these updates to the 6.x version of this module? This is a handy feature, and it would be great to see it in a 6.x release. I tried manually copying code from the patch files into the 6.x-1.x-dev version of the module, but there have been a lot of API changes and I was rather overwhelmed. Thanks for the work you have both put into this!

Dan

pavlos.g’s picture

Component: Code » Miscellaneous
Category: feature » bug

First of all, thanks for the patch. ;-)

I'm facing the following problem with the patching of advpoll.module (using advpoll-5.x-1.0-beta6):

patching file advpoll.module
Hunk #13 succeeded at 1307 with fuzz 1.
Hunk #16 FAILED at 1350.
Hunk #17 succeeded at 1369 (offset -3 lines).

the .rej file is the following:

***************
*** 1320,1328 ****
*/
function advpoll_view_results(&$node, $teaser, $page) {
$mode = _advpoll_get_mode($node->type);
- if ($node->voted && $node->cancel_vote && user_access('cancel own vote') && _advpoll_is_active($node)) {
- $output .= '

'.t('Your vote was registered.').'

';
- }
if (_advpoll_can_view_results($node)) {
if (function_exists('advpoll_view_results_'. $mode)) {
$results = call_user_func('advpoll_view_results_'. $mode, $node, $teaser, $page);
--- 1350,1355 ----
*/
function advpoll_view_results(&$node, $teaser, $page) {
$mode = _advpoll_get_mode($node->type);
if (_advpoll_can_view_results($node)) {
if (function_exists('advpoll_view_results_'. $mode)) {
$results = call_user_func('advpoll_view_results_'. $mode, $node, $teaser, $page);

Anyone else facing this problem?

FredsFriend’s picture

Has ther been any progress on this feature in 6.x-1.x dev, i've been banging my head against a brick wall for the last few days trying to get this functionality. It's pretty much a dealbreaker for us using polls.

netsensei’s picture

Subscribing.

While keeping sessions or cookies to register votes has it's drawbacks, from a usability point of view, I would still prefer this method over registering by ip address.

ericbroder’s picture

Subscribing.

ambo’s picture

Hi there,

sorry but I am not using this one anymore in Drupal 5 nore do I have the knowledge to port it to the Drupal 6 Version of the poll module. If anyone find this usefull feel free to use it for ports to newer versions of this module.

Regards - Andreas

ambo’s picture

Status: Needs work » Closed (won't fix)