1. 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

Discussion in 'XenForo Questions and Support' started by 0xym0r0n, Jan 11, 2012.

  1. 0xym0r0n

    0xym0r0n Well-Known Member

    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.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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 likes this.
  3. 0xym0r0n

    0xym0r0n Well-Known Member

    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. Bigstack

    Bigstack Member

    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: Jun 25, 2013
    0xym0r0n and Jake Bunce like this.
  5. averythomas

    averythomas Member

    Where do I find the poll ID on a certain forum page?
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    When you click Edit in the poll inside of the thread the pollid can be seen in the URL.
     

  7. 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!
     
  8. AndyB

    AndyB Well-Known Member

    Use phpMyAdmin.
     
  9. flash84

    flash84 Member

    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
    
     

Share This Page