• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Filtering poll votes

Darfuria

Active member
#1
The voting for a pretty hefty competition was foolishly run through a poll on a forum I administrate. The unfortunate result was of course that people signed up for multiple accounts to vote on the poll more than once.

Through executing an SQL query, would there be a way of me getting results of the poll based on unique IP addresses, or only counting people who have a postcount greater than 0?
 

Jake Bunce

XenForo moderator
Staff member
#2
Through executing an SQL query, would there be a way of me getting results of the poll based on unique IP addresses...
IPs aren't logged for poll votes. The best you can hope to do is select unique votes based on users' other IP history. It's not an ideal solution. And I don't have a query for this.

...or only counting people who have a postcount greater than 0?
Here is a query for that:

Code:
SELECT pr.response, COUNT(*)
FROM xf_poll_vote AS pv
LEFT JOIN xf_poll_response AS pr ON (pr.poll_response_id = pv.poll_response_id)
LEFT JOIN xf_user AS u ON (u.user_id = pv.user_id)
WHERE pv.poll_id = 1
AND u.message_count > 0
GROUP BY pv.poll_response_id
You need to specify the pollid (WHERE pv.poll_id = 1).

You will get results like this:

Screen shot 2011-06-11 at 6.29.41 AM.png