Viewing Who voted in polls

Started by mattchewone, June 29, 2009, 04:13:51 PM

Previous topic - Next topic

mattchewone

Hi,

Is there a way to view who voted what in a poll?

Many Thanks

Matt

N3RVE

Run this query in phpMyAdmin (What is phpMyAdmin?)

Code (Run) Select
SELECT smf_members.realName, smf_poll_choices.label
FROM smf_log_polls
INNER JOIN smf_members ON smf_log_polls.ID_MEMBER = smf_members.ID_MEMBER
INNER JOIN smf_poll_choices ON smf_log_polls.ID_CHOICE = smf_poll_choices.ID_CHOICE
AND smf_log_polls.ID_POLL = smf_poll_choices.ID_POLL
WHERE smf_log_polls.ID_POLL = 42


Replace ID_POLL = 42 with the ID of the poll you want to check.

-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

Nao 尚

I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

mattchewone


Nao 尚

Hmm I'm using it on Noisen... Which runs the latest SMF2...
Of course if you don't feel like fixing the mod here and there, I can't help much.
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

STS

How do you know what poll it is, the number?

Yahmez

Quote from: STS on October 16, 2009, 05:23:53 PM
How do you know what poll it is, the number?
The topic number that the poll is in. Hover you mouse over a link to a topic to see the number in the url. (e.g. http://www.yoursite.com/community/index.php?topic=384.0)

Yahmez

Quote from: Nao/Gilles on July 01, 2009, 05:53:53 PM
Hmm I'm using it on Noisen... Which runs the latest SMF2...
Of course if you don't feel like fixing the mod here and there, I can't help much.
Any tips for making the mod work in 2.0?

STS


Nao 尚

Quote from: Yahmez on October 16, 2009, 06:55:41 PM
Any tips for making the mod work in 2.0?
Maybe if you'd asked 2 years ago, back when I converted it?
Right now, I can just tell you it's easy to do...
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

Yahmez

Quote from: Nao/Gilles on October 17, 2009, 07:20:55 AM
Quote from: Yahmez on October 16, 2009, 06:55:41 PM
Any tips for making the mod work in 2.0?
Maybe if you'd asked 2 years ago, back when I converted it?
Right now, I can just tell you it's easy to do...
Well I have only been here 9 months... Oh well, maybe when SMF 7 comes out I'll go back to 2007 and ask you then.  ;D

SgtMic

Quote from: Nao/Gilles on October 17, 2009, 07:20:55 AM
Right now, I can just tell you it's easy to do...
I saw the changes in /sources/managepermissions as easy.
The changes to /default/display.template were out of my realm.

Can you show us the correct way to make those changes?
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Nao 尚

I only see one thing to replace in the Display template...?

foreach ($context['poll']['options'] as $option)
echo '
   <dt class="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
   <dd class="middletext', $option['voted_this'] ? ' voted' : '', '">', $context['allow_poll_view'] ? '<span class="percent">' . $option['votes'] . ' (' . $option['percent'] . '%)</span>' . $option['bar_ndt'] : '', '</dd>';


Becomes:

foreach ($context['poll']['options'] as $option)
{
echo '
   <dt class="middletext', $option['voted_this'] ? ' voted' : '', '">', $option['option'], '</dt>
   <dd class="middletext', $option['voted_this'] ? ' voted' : '', '">', $context['allow_poll_view'] ? '<span class="percent">' . $option['votes'] . ' (' . $option['percent'] . '%)</span>' . $option['bar_ndt'] : '';
if ($context['allow_poll_view'] && allowedTo('poll_view_voters') && !empty($context['poll']['options'][$option['id_option']]['voters']))
foreach ($context['poll']['options'][$option['id_option']]['voters'] as $voter)
echo ' <small><a href="', $scripturl, strpos($voter['id_member'], '.') === false ? '?action=profile;u=' . $voter['id_member'] . '">' . $voter['real_name'] : '?action=trackip;searchip=' . $voter['id_member'] . '">' . $voter['id_member'], '</a></small>';
}


Well, at least that's direct from my noisen.com source code.
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

SgtMic

There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

SgtMic

Get this error trying to install via package manager:
Fatal error: Call to undefined function db_query() in /home/wamarin/public_html/wammc/Packages/temp/wvwDB.php on line 9

Lines 1-12
<?php

if ($context['uninstalling'])
{
  
db_query("DELETE IGNORE FROM {$db_prefix}settings WHERE variable='whovotedwhatMode' LIMIT 1"__FILE____LINE__);
}
else
{
  
db_query("INSERT IGNORE INTO {$db_prefix}settings (variable, value) VALUES ('whovotedwhatMode', 'disabled')"__FILE____LINE__);
}

?>
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Nao 尚

Well... Obviously you're supposed to use $smcFunc['db_query'] in SMF2 or just declare a fake db_query that emulates it.)
Ever made a SMF2 package before?
I will not make any deals with you. I've resigned. I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered.

Aeva Media rocks your life.

SgtMic

No, I have not made an SMF2 package before. That's why I'm here asking for help. :)
There is nothing more deadly than a US Marine and his rifle.
A close second is a US Marine and his K-BAR.
2/5 Fox Co.  (BlackHearts)
FAST Co. 5th Plt. (FIDO)

Ray Cardillo

Quote from: mattchewone on June 29, 2009, 04:13:51 PM
Is there a way to view who voted what in a poll?

I know this is an old thread, but check out this new mod that provides voter visibility with several advanced options.

http://custom.simplemachines.org/mods/index.php?mod=3373
Author of the Voter Visibility mod customization.  Adds the ability to see (and control who sees) who voted for what.  Allows you to conduct secret ballots.  Can also be used to coordinate volunteer signups, and more.

dkpeppard

Quote from: N3RVE on June 30, 2009, 12:43:53 PM
Run this query in phpMyAdmin (What is phpMyAdmin?)

Code (Run) Select
SELECT smf_members.realName, smf_poll_choices.label
FROM smf_log_polls
INNER JOIN smf_members ON smf_log_polls.ID_MEMBER = smf_members.ID_MEMBER
INNER JOIN smf_poll_choices ON smf_log_polls.ID_CHOICE = smf_poll_choices.ID_CHOICE
AND smf_log_polls.ID_POLL = smf_poll_choices.ID_POLL
WHERE smf_log_polls.ID_POLL = 42


Replace ID_POLL = 42 with the ID of the poll you want to check.

-[n3rve]

I realize this is an old post, but I think the information is still valid.

I tried running this query in my phpAdmin. I changed to the correct poll ID number but I get the following error:

#1054 - Unknown column 'smf_members.realName' in 'field list'

I am a phpAdmin novice. Can you direct me to what I may be doing wrong, please? I am currently using Simple Machines 2.0.5.

Arantor

Then apparently it isn't still valid :P

The column names were changed in 2.0.

Try this:
SELECT smf_members.real_name, smf_poll_choices.label
FROM smf_log_polls
INNER JOIN smf_members ON smf_log_polls.id_member = smf_members.id_member
INNER JOIN smf_poll_choices ON smf_log_polls.id_choice = smf_poll_choices.id_choice
AND smf_log_polls.id_poll = smf_poll_choices.id_poll
WHERE smf_log_polls.id_poll = 42
Perhaps it would have been better if I'd simply never bothered. Y'all clearly would be less unhappy that way.

Advertisement: