############################################################## 
## MOD Title: Who Voted? 
## MOD Version: 0.0.1 
## Author: Verteron < 
verteron@verteron.net > 
http://verteron.net/efcl/ 
## Description: Show the usernames of registered users who have voted in a poll 
## 
## Installation Level: easy 
## Installation Time: 5 Minutes 
## Files To Edit: viewtopic.php, 
##      language/lang_english/lang_main.php, 
##      templates/subSilver/viewtopic_poll_result.tpl 
## 
## Included Files: n/a 
############################################################## 
## This MOD is released under the GPL License. 
## Intellectual Property is retained by the MOD Author(s) listed above 
############################################################## 
## For Security Purposes, Please Check: 
http://www.phpbb.com/mods/downloads/ for the 
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code 
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered 
## in our MOD-Database, located at: 
http://www.phpbb.com/mods/downloads/ 
############################################################## 
## Authors Notes: Default installation for subSilver and lang_english. Adjust 
## To your own themes and languages accordingly. Requires no extra database 
## queries. 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ OPEN ]------------------------------------------ 
# 
viewtopic.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
      $sql = "SELECT vote_id 
         FROM " . VOTE_USERS_TABLE . " 
         WHERE vote_id = $vote_id 
            AND vote_user_id = " . $userdata['user_id']; 
      if ( !($result = $db->sql_query($sql)) ) 
      { 
         message_die(GENERAL_ERROR, "Could not obtain user vote data for this topic", '', __LINE__, __FILE__, $sql); 
      } 
      $user_voted = ( $row = $db->sql_fetchrow($result) ) ? TRUE : 0; 
      $db->sql_freeresult($result); 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
      $sql = "SELECT username, user_id FROM " . VOTE_USERS_TABLE . ", " . USERS_TABLE . " WHERE vote_id = $vote_id AND vote_user_id = user_id GROUP BY username ORDER BY username"; 
      if ( !($result = $db->sql_query($sql)) ) 
      { 
         message_die(GENERAL_ERROR, "Could not obtain user vote data for this topic", '', __LINE__, __FILE__, $sql); 
      } 
      $user_voted = false; 
      $who_voted = ''; 
      $first_row = true; 
      while( $row = $db->sql_fetchrow($result) ) 
      { 
         $who_voted .= ($first_row ? '' : ', ') . '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>'; 
         if ( $row['user_id'] == $userdata['user_id'] ) 
         { 
            $user_voted = true; 
         } 
         $first_row = false; 
      } 
      $db->sql_freeresult($result); 
# 
#-----[ FIND ]------------------------------------------ 
# 
         $template->assign_vars(array( 
            'L_TOTAL_VOTES' => $lang['Total_votes'], 
            'TOTAL_VOTES' => $vote_results_sum) 
         ); 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
         $template->assign_vars(array( 
            'L_TOTAL_VOTES' => $lang['Total_votes'], 
            'TOTAL_VOTES' => $vote_results_sum, 
            'L_WHO_VOTED' => $lang['Who_Voted'], 
            'WHO_VOTED' => $who_voted) 
         ); 
# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php 
# 
#-----[ FIND ]------------------------------------------ 
# 
$lang['Total_votes'] = 'Total Votes'; 
# 
#-----[ ADD, AFTER ]------------------------------------------ 
# 
$lang['Who_Voted'] = 'Who Voted'; 
# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/viewtopic_poll_result.tpl 
# 
#-----[ FIND ]------------------------------------------ 
# 
     <tr> 
      <td colspan="4" align="center"><span class="gen"><b>{L_TOTAL_VOTES} : {TOTAL_VOTES}</b></span></td> 
     </tr> 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
   <tr> 
      <td colspan="4" align="center"><span class="gensmall"><b>{L_WHO_VOTED}</b> : {WHO_VOTED}</span></td> 
   </tr> 
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM