By RFree190 on
I'm using Drupal 5.1 with Advanced Poll and VotingAPI.
When a user votes on the AdvPoll, it closes the poll. I assume it is logging the votes using the IP address and not the USERID, so when I'm testing on my computer, the same IP address is being used and thus, only one vote is allowed.
My problem is that when my site goes live, it will be accessed from several office computers and will be using a limited number of IP addresses. SO, users won't be able to vote after someone else votes using the same IP.
Is there a way to change either AdvPoll or VotingAPI to log votes using the UserID and not the IP address?
Thanks.
Comments
Tried Different Browsers
I've tried using the Poll from different browsers, but still the same result. It closes the poll after the first person votes. I've tried changing all the settings within the ADVPOLL module, but no luck.
Anyone have any ideas???
Thanks.
Same problem
Hi, I'm experiencing the same problem. :-( Using Drual 5.1 and Advanced Poll 5.x-1.0-beta4. Could it be a restriction of one vote per IP?
---
www.scorpions.sk
It's an IP restriction
It is a restriction of one vote per IP (or firewall IP), regardless of whether a user has logged in or not.
Try using www.the-cloak.com and you will see that the voting is open (even though you can't post using the-cloak).
Try my poll out, I put one vote on it already.
***************************
Looking for a discount online pharmacy and to recommend online pharmacies go
to www.PharmacySpy.com
a fix for the one vote problem
In the advpoll.module I changed three lines of code and now advpoll allows multiple votes per ip as long as the user id is different every time. I left a little of the code before and after the change to help you find where to replace the code.
// Check if the user's IP has already voted.
if (!$cancel_vote) {
$host = $_SERVER['HTTP_X_FORWARDED_FOR']? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$result = db_query("SELECT uid, value FROM {votingapi_vote} "
."WHERE content_id=%d AND content_type='advpoll' AND hostname='%s'",
$node->nid, $host);
if (db_num_rows($result) > 0) {
$voted = TRUE;
$obj = db_fetch_object($result);
below are the lines I change
if ($obj->uid != 0) {
// Only allow cancelling if initial vote was also anonymous
$cancel_vote = FALSE;
$voted = FALSE;
}
}
}
return array($voted, $cancel_vote);
}
I hope this helps!
Exactly
where are the original lines?