Show Poll Voters
Posted: 11 Feb 2012, 19:39
Show voters under vote bars for Admins and Moderators only
OPEN: viewtopic.php
FIND:
ADD-AFTER:
FIND:
Replace-With:
OPEN:
styles/XXXX/template/viewtopic_body.php
FIND In proSilver theme:
Replace-With:
It exists many mods similar. I like this one in this way. Cheers!
Note: This mod is based on evaarties' show poll voters for phpBB3. There are a lot of improvement from the original version. The new features I added are: user colour and cleaning up some codes.
OPEN: viewtopic.php
FIND:
Code: Select all
$poll_info[$i]['poll_option_text'] = bbcode_nl2br($poll_info[$i]['poll_option_text']);
$poll_info[$i]['poll_option_text'] = smiley_text($poll_info[$i]['poll_option_text']);
Code: Select all
/***********************************************************************************
Begin 'Show voters' MOD by Ernst Vaarties and edited by Leinad4Mind
************************************************************************************/
$sql_voters = '
SELECT u.username, u.user_colour, pv.vote_user_id
FROM ' . POLL_VOTES_TABLE . ' pv, ' . USERS_TABLE . ' u
WHERE pv.topic_id = ' . $topic_id . '
AND poll_option_id = ' . $poll_info[$i]['poll_option_id'] . '
AND pv.vote_user_id = u.user_id
ORDER BY u.username_clean ASC, pv.vote_user_id ASC';
$results_voters = $db->sql_query($sql_voters);
$voters_total = 0;
$voters_string = "";
// Add all voters to a string.
while ($row_voters = $db->sql_fetchrow($results_voters))
{
$voters_total = $voters_total + 1;
$voters_string = $voters_string . "<option style='font-weight:bold; color:#" . $row_voters['user_colour'] . "'; value='u=" . $row_voters['vote_user_id'] . "'>" . $row_voters['username'] ."</option>";
}
// Is the total nr of voters <> the nr of votes for the poll? Add this to the same string.
if ($voters_total <> $poll_info[$i]['poll_option_total'])
{
$voters_string = $voters_string . "<option><> " . ($poll_info[$i]['poll_option_total'] - $voters_total) . "</option>";
}
// Add the string to the list.
$poll_info[$i]['poll_option_voters'] = $voters_string;
$db->sql_freeresult($results_voters);
/***********************************************************************************
Begin 'Show voters' MOD by Ernst Vaarties and edited by Leinad4Mind
************************************************************************************/
FIND:
Code: Select all
'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false)
Replace-With:
Code: Select all
/***********************************************************************************
Begin 'Show voters' MOD by Ernst Vaarties and edited by Leinad4Mind
************************************************************************************/
// 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false)
'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false,
'POLL_OPTION_VOTERS' => $poll_option['poll_option_voters'])
/***********************************************************************************
Begin 'Show voters' MOD by Ernst Vaarties and edited by Leinad4Mind
************************************************************************************/
OPEN:
styles/XXXX/template/viewtopic_body.php
FIND In proSilver theme:
Code: Select all
<!-- ELSE -->{poll_option.POLL_OPTION_PERCENT}<!-- ENDIF -->
Code: Select all
<!-- ELSE --><!-- IF not U_ACP or not U_MCP -->{poll_option.POLL_OPTION_PERCENT}<!-- ENDIF -->
<!-- IF U_ACP or U_MCP -->
<select style="font-size: xx-small;">
<option>{L_USERNAMES}:</option>";
<option><span style="font-weight:bold; color:#{S_USER_COLOUR};">{poll_option.POLL_OPTION_VOTERS}</span></option>
</select>
<!-- ENDIF --><!-- ENDIF -->
It exists many mods similar. I like this one in this way. Cheers!
Note: This mod is based on evaarties' show poll voters for phpBB3. There are a lot of improvement from the original version. The new features I added are: user colour and cleaning up some codes.