Back to vBulletin 3.7 Add-ons

Make poll preview a REAL preview
Mod Version: 1.00, by Lea Verou

This modification is in the archives.
vB Version: 3.7.2 Rating: (1 vote - 5.00 average) Installs: 13
Released: 12 Aug 2008 Last Update: 12 Aug 2008 Downloads: 41
Not Supported Template Edits Code Changes Re-usable Code Translations  

As I stated in http://www.vbulletin.com/forum/index.php?t=281504, the current poll preview feature sucks.

For those who can't wait till Jelsoft fixes this, here is a solution:

Warning: If you are allergic to file edits or to manual template changes, don't read further.

Template changes: 1
File edits: 1


In poll.php find (around lines 202-215 in an unmodified version of poll.php):
PHP Code:
        if ($vbulletin->GPC['preview'] != '')
        {
            
$previewpost 1;

            
$counter 0;
            
$pollpreview '';
            
$previewquestion $bbcode_parser->parse(unhtmlspecialchars($question), $foruminfo['forumid'], $foruminfo['allowsmilies']);
            while (
$counter++ < $polloptions)
            {
                
$pollpreviewbits .= "&nbsp;&nbsp; $counter. &nbsp; " $bbcode_parser->parse($vbulletin->GPC['options']["$counter"], $foruminfo['forumid'], $foruminfo['allowsmilies']) . '<br />';
            }

            eval(
'$pollpreview = "' fetch_template('pollpreview') . '";');
        } 
and delete (or comment) them.

Then find (it should be right after the lines you just deleted/commented):
PHP Code:
        $checked = array(
            
'multiple'       => ($vbulletin->GPC['multiple'] ? 'checked="checked"' ''),
            
'public'         => ($vbulletin->GPC['public'] ? 'checked="checked"' ''),
            
'parseurl'       => ($vbulletin->GPC['parseurl'] ? 'checked="checked"' ''),
        ); 
and add below:
PHP Code:
        if ($vbulletin->GPC['preview'] != '')
        {
            
$previewpost 1;

            
$counter 0;
            
$pollpreview '';
            
$pollinfo['question'] = $bbcode_parser->parse(unhtmlspecialchars($question), $foruminfo['forumid'], $foruminfo['allowsmilies']);
            if(
$checked['public']) $show['publicwarning'] = true;
            if(
$timeout)
            {
                
$pollinfo['dateline'] = TIMENOW;
                
$pollinfo['timeout'] = $timeout;
                
$pollendtime vbdate($vbulletin->options['timeformat'], $pollinfo['dateline'] + ($pollinfo['timeout'] * 86400));
                
$pollenddate vbdate($vbulletin->options['dateformat'], $pollinfo['dateline'] + ($pollinfo['timeout'] * 86400));
                
$show['pollenddate'] = true;
            }
            
            while (
$counter++ < $polloptions)
            {
                
$option['number'] = $counter;
                
$option['question'] = $bbcode_parser->parse($vbulletin->GPC['options']["$counter"], $foruminfo['forumid'], $foruminfo['allowsmilies']);
                
                if (
$checked['multiple'])
                {
                    eval(
'$pollbits .= "' fetch_template('polloption_multiple') . '";');
                }
                else
                {
                    eval(
'$pollbits .= "' fetch_template('polloption') . '";');
                }
                    
            }

            eval(
'$pollpreview = "' fetch_template('polloptions_table') . '";');
        } 
In template newpoll find:
HTML Code:
<form action="poll.php?do=postpoll&amp;t=$threadid" method="post">
$pollpreview
and change it to:
HTML Code:
$pollpreview
<form action="poll.php?do=postpoll&amp;t=$threadid" method="post">
Presto!
Enjoy your new REAL poll preview!

Download

This modification is archived, downloads are still allowed.

File Type: %1$s pollpreview.txt (4.2 KB, 43 downloads)

Screenshots

Click image for larger version
Name:	pollpreview.gif
Views:	640
Size:	73.3 KB
ID:	85357  

Similar Mods

Forum Display Enhancements [AJAX] Ajax Poll Preview vBulletin 3.7 Add-ons

vblts.ru supports vBulletin®, 2022-2024