PDA

View Full Version : New Posting Features - Make poll preview a REAL preview


Lea Verou
08-11-2008, 10:00 PM
As I stated in my corresponding vB suggestion (http://www.vbulletin.com/forum/showthread.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):
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):
$checked = array(
'multiple' => ($vbulletin->GPC['multiple'] ? 'checked="checked"' : ''),
'public' => ($vbulletin->GPC['public'] ? 'checked="checked"' : ''),
'parseurl' => ($vbulletin->GPC['parseurl'] ? 'checked="checked"' : ''),
);

and add below:
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:
<form action="poll.php?do=postpoll&amp;t=$threadid" method="post">

$pollpreview
and change it to:
$pollpreview

<form action="poll.php?do=postpoll&amp;t=$threadid" method="post">
Presto!
Enjoy your new REAL poll preview!:)

db90
08-12-2008, 06:00 AM
Nice!

TimberFloorAu
08-12-2008, 08:30 AM
doesnt look any different to me, from your screenshot

Spank
08-12-2008, 09:13 AM
Same here except for maybe the little squares.

Lea Verou
08-12-2008, 10:29 PM
You are probably looking at a poll, not a poll PREVIEW.
Go to new poll, enter some options and hit "Preview poll".
Then you'll probably understand what I'm talking about. ;)

Subah
08-12-2008, 11:39 PM
You are probably looking at a poll, not a poll PREVIEW.
Go to new poll, enter some options and hit "Preview poll".
Then you'll probably understand what I'm talking about. ;)

Please can we have screenshot of the poll preview ?

Lea Verou
08-13-2008, 12:00 AM
It is already attached as a screenshot!

What this hack does is that it makes the poll preview look like an actual poll, so that its a more realistic preview.

sockwater
08-13-2008, 04:02 AM
Maybe this will help...

https://vborg.vbsupport.ru/attachment.php?attachmentid=85386&stc=1&d=1218603741


BTW, I would consider this a bug, since there is hardcoded HTML in the PHP files.

Lea Verou
08-13-2008, 04:14 AM
Thanks sockwater, I hope your screenshot will help. :)

It isn't exactly a bug, its just a very bad decision from the vB devs...

sockwater
08-13-2008, 04:36 AM
It isn't exactly a bug, its just a very bad decision from the vB devs...I thought I read somewhere one of the developers said that any HTML that is not in templates, that is hardcoded in the php files should be reported to the bug tracker. But now I can't find it. :(

Lea Verou
08-13-2008, 08:05 AM
That's very nice of them :)

I don't think though that it's needed to duplicate it in the Bug Tracker since I opened a suggestion thread for it, do I? What's your opinion?

sockwater
08-13-2008, 01:40 PM
I don't know. You're probably right, since they read the suggestion threads as well.

Corndog235
08-13-2008, 01:43 PM
Thanks, havent ran into a problem yet :)

xorex
08-13-2008, 05:37 PM
Thanks !

Taragon
11-09-2009, 09:03 PM
thanks :) working fine on v3.8.4