Seite 1 von 1

[MOD] [BETA] Show poll voters for phpBB3

Verfasst: 06.08.2007 10:22
von Foren Mitglied
Quelle: http://www.phpbb.com/community/viewtopi ... 0&t=571804

MOD Description: This MOD changes the percentage next to a vote resultbar to a dropdownlist showing the percentage and the users who voted for that option.
If the total of votes is different to the number of voters, this is shown as the last item in the list with "<> #nr" wher nr is the difference.

This MOD has been made for phpBB 3 RC4 and has no limitations, ie everyone that may see the poll results will also see who voted for which option.

ÖFFNE viewtopic.php

SUCHE:

Code: Alles auswählen

        $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']);            
DANACH EINFÜGEN:

Code: Alles auswählen

        /* Begin 'Show voters' MOD by Ernst Vaarties */
        $sql_voters = '
            SELECT username, vote_user_id, user_colour
            FROM ' . POLL_VOTES_TABLE . ', ' . USERS_TABLE . '
            WHERE topic_id = ' . $topic_id . '
                AND poll_option_id = ' . $poll_info[$i]['poll_option_id'] . '
                AND ' . POLL_VOTES_TABLE . '.vote_user_id = ' . USERS_TABLE . '.user_id
            ORDER BY username ASC, 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 . ", " . get_username_string('full', $row_voters['vote_user_id'], $row_voters['username'], $row_voters['user_colour'], $row_voters['username']);
        }

        // 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 . ", <> " . ($poll_info[$i]['poll_option_total'] - $voters_total);
        }

        $voters_string = ltrim($voters_string, ", ");

        // Add the string to the list.
        $poll_info[$i]['poll_option_voters'] = $voters_string;
        $db->sql_freeresult($results_voters);
        /* End 'Show voters' MOD by Ernst Vaarties */            
SUCHE:

Code: Alles auswählen

            'POLL_OPTION_VOTED'        => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false)            
DAVOR EINFÜGEN:

Code: Alles auswählen

            'POLL_OPTION_VOTERS'     => $poll_option['poll_option_voters'],            
ÖFFNE viewtopic_body.html

SUCHE:

Code: Alles auswählen

<!-- ELSE -->{poll_option.POLL_OPTION_PERCENT}<!-- ENDIF -->            
ERSETZE MIT:

Code: Alles auswählen

                        <!-- ELSE -->
                            {poll_option.POLL_OPTION_PERCENT}
                             <!-- IF  not S_CAN_VOTE--><dt>&nbsp;</dt><!-- ENDIF -->
                            <dd class="resultbar">
                                {poll_option.POLL_OPTION_VOTERS}
                            </dd>
                        <!-- ENDIF -->            

Re: [MOD] [BETA] Show poll voters for phpBB3

Verfasst: 01.09.2010 10:17
von Foren Mitglied
Dieses MOD wurde ein wenig "aufgewertet" und wird in diesem Thema weitergeführt:

[MOD] [Beta] Advanced Show Poll Voters 0.0.1