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

XF 1.1 Who voted on private poll

0xym0r0n

Well-known member
#1
I like to keep the results of a poll from the public eye but I allow multi-accounts on my site (for various reasons). I keep note of these accounts and I need to make sure that certain polls do not have mult-account abuse.

I don't want the votes to be public. I'd like the admins to be able to view who voted to ensure that there was no double voting (abuse of multi-accounts).

Am I being blind again? I've been searching off and on for a few hours and only found out how to view who voted on a public poll.
 

Jake Bunce

XenForo moderator
Staff member
#2
Using phpmyadmin to browse the xf_poll_response table, you can see the voter names. You need to show full text and blob contents for it to show though:

Screen shot 2012-01-10 at 10.44.24 PM.png

Or you can run this query. The query results are more readable if you have a lot of votes to look at:

Code:
SELECT u.username, pr.response
FROM xf_poll_vote AS pv
LEFT JOIN xf_user AS u ON (u.user_id = pv.user_id)
LEFT JOIN xf_poll_response AS pr ON (pr.poll_response_id = pv.poll_response_id)
WHERE pv.poll_id = 2
ORDER BY pv.poll_response_id;
You need to enter the poll_id. You will get results like this:

Screen shot 2012-01-10 at 10.51.49 PM.png
 

0xym0r0n

Well-known member
#3
Yeah that's what i was using for right now. I thought there might be a way via the actual forum. Might try to do an addition myself. Thanks though!
 
#4
Once you find the poll_id via the response table I made query that will provide the IP / Posts / Join dates.... This can help to find voter fraud! maybe next election I can get hired!

You need to enter the poll_id. (at bottom) ~ its at 408 for example

Code:
SELECT
  u.username AS Username,
  pr.response AS 'Voted For',
  INET_NTOA(xf_ip.ip) AS 'IP Address',
  DATE_FORMAT(FROM_UNIXTIME(u.register_date), '%b %d %Y') AS 'Join Date',
  u.message_count AS Posts
FROM xf_poll_vote pv
  LEFT OUTER JOIN xf_user u
  ON u.user_id = pv.user_id
  LEFT OUTER JOIN xf_poll_response pr
  ON pr.poll_response_id = pv.poll_response_id
  INNER JOIN xf_ip
  ON xf_ip.ip_id = u.user_id
WHERE pv.poll_id = 408
ORDER BY pr.response, 'Join Date', u.message_count
sql_vote.PNG
 
Last edited:
#5
Using phpmyadmin to browse the xf_poll_response table, you can see the voter names. You need to show full text and blob contents for it to show though:

View attachment 23496

Or you can run this query. The query results are more readable if you have a lot of votes to look at:

Code:
SELECT u.username, pr.response
FROM xf_poll_vote AS pv
LEFT JOIN xf_user AS u ON (u.user_id = pv.user_id)
LEFT JOIN xf_poll_response AS pr ON (pr.poll_response_id = pv.poll_response_id)
WHERE pv.poll_id = 2
ORDER BY pv.poll_response_id;
You need to enter the poll_id. You will get results like this:

View attachment 23497
Where do I find the poll ID on a certain forum page?
 
#7
Once you find the poll_id via the response table I made query that will provide the IP / Posts / Join dates.... This can help to find voter fraud! maybe next election I can get hired!

You need to enter the poll_id. (at bottom) ~ its at 408 for example

Code:
SELECT
  u.username AS Username,
  pr.response AS 'Voted For',
  INET_NTOA(xf_ip.ip) AS 'IP Address',
  DATE_FORMAT(FROM_UNIXTIME(u.register_date), '%b %d %Y') AS 'Join Date',
  u.message_count AS Posts
FROM xf_poll_vote pv
  LEFT OUTER JOIN xf_user u
  ON u.user_id = pv.user_id
  LEFT OUTER JOIN xf_poll_response pr
  ON pr.poll_response_id = pv.poll_response_id
  INNER JOIN xf_ip
  ON xf_ip.ip_id = u.user_id
WHERE pv.poll_id = 408
ORDER BY pr.response, 'Join Date', u.message_count
View attachment 49879

Bigstack ... thanks for posting this. Nearly exactly what I was looking for when I found this page.

However, noobish question ... where is it that you type in this code to get these results?

Thanks!
 
#9
Once you find the poll_id via the response table I made query that will provide the IP / Posts / Join dates.... This can help to find voter fraud! maybe next election I can get hired!

You need to enter the poll_id. (at bottom) ~ its at 408 for example

Code:
SELECT
  u.username AS Username,
  pr.response AS 'Voted For',
  INET_NTOA(xf_ip.ip) AS 'IP Address',
  DATE_FORMAT(FROM_UNIXTIME(u.register_date), '%b %d %Y') AS 'Join Date',
  u.message_count AS Posts
FROM xf_poll_vote pv
  LEFT OUTER JOIN xf_user u
  ON u.user_id = pv.user_id
  LEFT OUTER JOIN xf_poll_response pr
  ON pr.poll_response_id = pv.poll_response_id
  INNER JOIN xf_ip
  ON xf_ip.ip_id = u.user_id
WHERE pv.poll_id = 408
ORDER BY pr.response, 'Join Date', u.message_count
View attachment 49879
The above query kept returning zero results for me. Something up with the ip address query. Anyway I took that out and following query is working for anyone else experiencing trouble:

Code:
SELECT
  u.username AS 'Username',
  pr.response AS 'Voted For',
  DATE_FORMAT(FROM_UNIXTIME(u.register_date), '%b %d %Y') AS 'Join Date',
  u.message_count AS 'Posts'
FROM xf_poll_vote pv
  LEFT OUTER JOIN xf_user u
  ON u.user_id = pv.user_id
  LEFT OUTER JOIN xf_poll_response pr
  ON pr.poll_response_id = pv.poll_response_id
WHERE pv.poll_id = 741
ORDER BY `u`.`message_count` ASC