XF 1.5 Viewing who voted on what options in a poll

Dan Hawkins

Active member
Howdy,

I'm trying to find out which user voted on what answer in the database.

We have a poll where we ask for certain members to vote, but others have voted (confirmed via AndyB's addon Who Voted) - I want to see who voted on what answer (NOT TO EDIT) so I can removed / calculate the correct poll result via the database results....

Any help would be appreciated.
 

Mike

XenForo developer
Staff member
If the poll isn't public, the only option would be to go into the database and look at the various xf_poll tables (there are a few involved).
 

Dan Hawkins

Active member
If the poll isn't public, the only option would be to go into the database and look at the various xf_poll tables (there are a few involved).
Cheers Mike, thought that was the case so looked in DB and found Three tables which appear to be the poll ones. (xf_poll, xf_poll_response, poll_vote)..

Is there an SQL script to hand to combine the tables and get the votes for poll X (we just want to see the votes from the people who should have been voting - and discount the ones who shouldn't have voted, obviously I wouldn't be editing the database, but when I write the results in the thread, I want to only include the right votes).

Unfortunately the poll creator (not me) didn't make the poll public :(

Ta!
 

Dan Hawkins

Active member
Thank you very much, I was able to get the result, then turn the poll back to private.

I really, really do appreciate that @Optic. Thank you!

For the answer:
Check the table xf_poll for the poll_id (this is normally in the url of the thread) then run (thanks to @Brogan for this, in this thread):

Code:
UPDATE xf_poll SET public_votes =** WHERE content_id =**
In the code above:
1)
public_votes =**
Replace ** with 1 (for visible) or 0 (for private)

2)
content_id =**
Replace ** with the thread id/poll_id
 
Top