Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Add-ons

Reply
 
Thread Tools
Make poll preview a REAL preview Details »»
Make poll preview a REAL preview
Version: 1.00, by Lea Verou Lea Verou is offline
Developer Last Online: Jul 2012 Show Printable Version Email this Page

Category: New Posting Features - Version: 3.7.2 Rating:
Released: 08-11-2008 Last Update: 08-11-2008 Installs: 13
Template Edits
Re-useable Code Code Changes Translations  
No support by the author.

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!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
Abu2

Comments
  #2  
Old 08-12-2008, 06:00 AM
db90 db90 is offline
 
Join Date: Jul 2008
Posts: 35
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice!
Reply With Quote
  #3  
Old 08-12-2008, 08:30 AM
TimberFloorAu's Avatar
TimberFloorAu TimberFloorAu is offline
 
Join Date: May 2008
Location: Brisbane
Posts: 2,264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

doesnt look any different to me, from your screenshot
Reply With Quote
  #4  
Old 08-12-2008, 09:13 AM
Spank Spank is offline
 
Join Date: Jan 2007
Location: Scotland
Posts: 809
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Same here except for maybe the little squares.
Reply With Quote
  #5  
Old 08-12-2008, 10:29 PM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #6  
Old 08-12-2008, 11:39 PM
Subah's Avatar
Subah Subah is offline
 
Join Date: Feb 2006
Location: KUWAIT
Posts: 393
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michelle View Post
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 ?
Reply With Quote
  #7  
Old 08-13-2008, 12:00 AM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 08-13-2008, 04:02 AM
sockwater's Avatar
sockwater sockwater is offline
 
Join Date: Apr 2008
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe this will help...




BTW, I would consider this a bug, since there is hardcoded HTML in the PHP files.
Reply With Quote
  #9  
Old 08-13-2008, 04:14 AM
Lea Verou Lea Verou is offline
 
Join Date: Jul 2005
Location: Greece
Posts: 1,856
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks sockwater, I hope your screenshot will help.

It isn't exactly a bug, its just a very bad decision from the vB devs...
Reply With Quote
  #10  
Old 08-13-2008, 04:36 AM
sockwater's Avatar
sockwater sockwater is offline
 
Join Date: Apr 2008
Posts: 187
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Michelle View Post
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.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:00 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.08170 seconds
  • Memory Usage 2,330KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_html
  • (3)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete