vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=228)
-   -   New Posting Features - Make poll preview a REAL preview (https://vborg.vbsupport.ru/showthread.php?t=187870)

Lea Verou 08-11-2008 09:00 PM

Make poll preview a REAL preview
 
As I stated in my corresponding vB suggestion, 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!:)

db90 08-12-2008 05:00 AM

Nice!

TimberFloorAu 08-12-2008 07:30 AM

doesnt look any different to me, from your screenshot

Spank 08-12-2008 08:13 AM

Same here except for maybe the little squares.

Lea Verou 08-12-2008 09: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 10:39 PM

Quote:

Originally Posted by Michelle (Post 1597329)
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-12-2008 11:00 PM

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 03:02 AM

Maybe this will help...

https://vborg.vbsupport.ru/attachmen...1&d=1218603741


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

Lea Verou 08-13-2008 03: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 03:36 AM

Quote:

Originally Posted by Michelle (Post 1597485)
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. :(


All times are GMT. The time now is 10:33 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01719 seconds
  • Memory Usage 1,772KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_html_printable
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete