Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Embedded Poll (like UBB.Threads) Details »»
Embedded Poll (like UBB.Threads)
Version: 1.1, by Ianomed Ianomed is offline
Developer Last Online: Dec 2005 Show Printable Version Email this Page

Version: 3.0.6 Rating:
Released: 01-23-2005 Last Update: 01-29-2005 Installs: 11
 
No support by the author.

Embedded Poll Hack v1.1 by Ianomed, a request from TheAdminZone

It's a simple addition to showthread.php, and two template mods (showthread + postbit[legacy])

What it does is embed a poll in the first post, rather than show it at the top of the thread. On pages 2+ of course it'll show it at the top of the thread, since post 1 won't be displayed there.

See attached screenshot for an example, or check out this poll

Works with and tested on vB 3.0.6

Changelog:
v1.1 - 30 January 2005 - Added support for hybrid+threaded mode
v1.0 - 24 January 2005 - Initial release

--- Install instructions ---

in showthread.php, find:
PHP Code:
################################################################################
####################### SHOW THREAD IN LINEAR MODE #############################
################################################################################
if ($threadedmode == 0)

below find:
PHP Code:
        $post['musername'] = fetch_musername($post);
        
$post['islastshown'] = ($post['postid'] == $lastpostid);
        
$post['attachments'] = &$postattach["$post[postid]"];

        if (
$post['isdeleted'])
        {
            
$template 'postbit_deleted';
        }
        else
        {
            
$template 'postbit';
        }
        
$postbits .= construct_postbit($post$template); 
replace with:
PHP Code:
        $post['musername'] = fetch_musername($post);
        
$post['islastshown'] = ($post['postid'] == $lastpostid);
        
$post['attachments'] = &$postattach["$post[postid]"];

        if (
$post['isdeleted'])
        {
            
$template 'postbit_deleted';
        }
        else
        {
            
$template 'postbit';
        }
        
// embedded poll
        
if ($poll && ($post['postcount'] == 1))
        {
            
$post['pollresults']=$poll;
        }
        else
        {
            
$post['pollresults']="";
        }
        
// embedded poll end
        
$postbits .= construct_postbit($post$template); 
find:
PHP Code:
################################################################################
################ SHOW THREAD IN THREADED OR HYBRID MODE ########################
################################################################################
}
else

below find:
PHP Code:
    // init
    
$postcount 0;
    
$postbits '';
    
$saveparsed '';
    
$jspostbits '';

    foreach (
explode(','$cache_postids) AS $id)
    {
        
// get the post from the post array
        
if (!isset($postarray["$id"]))
        {
            continue;
        }
        
$post $postarray["$id"];

        
$post['musername'] = fetch_musername($post);
        
$post['postcount'] = ++$postcount;

        
$parsed_postcache = array('text' => '''images' => 1);

        
$template iif($post['isdeleted'], 'postbit_deleted''postbit');

        
$post['attachments'] = &$postattach["$post[postid]"];
        
$bgclass 'alt2';
        if (
$threadedmode == 2// hybrid display mode
        
{
            
$postbits .= construct_postbit($post$template);
        }
        else 
// threaded display mode
        
{
            
$postbit construct_postbit($post$template); 
replace with:
PHP Code:
    // init
    
$postcount 0;
    
$postbits '';
    
$saveparsed '';
    
$jspostbits '';

    foreach (
explode(','$cache_postids) AS $id)
    {
        
// get the post from the post array
        
if (!isset($postarray["$id"]))
        {
            continue;
        }
        
$post $postarray["$id"];

        
$post['musername'] = fetch_musername($post);
        
$post['postcount'] = ++$postcount;

        
$parsed_postcache = array('text' => '''images' => 1);

        
$template iif($post['isdeleted'], 'postbit_deleted''postbit');

        
$post['attachments'] = &$postattach["$post[postid]"];
        
// embedded poll
        
if ($poll && ($post['postcount'] == 1))
        {
            
$post['pollresults']=$poll;
        }
        else
        {
            
$post['pollresults']="";
        }
        
// embedded poll end
        
$bgclass 'alt2';
        if (
$threadedmode == 2// hybrid display mode
        
{
            
$postbits .= construct_postbit($post$template);
        }
        else 
// threaded display mode
        
{
            
$postbit construct_postbit($post$template); 
save and close file.

open template SHOWTHREAD, find (near the top):
PHP Code:
$poll 
replace with: (this makes sure the poll will appear at the top on pages 2+, as per default, but hides it on page 1)
PHP Code:
<if condition="$pagenumber > 1">
$poll
</if> 
finally open template postbit or postbitlegacy (depending on your preferences), find:
PHP Code:
<!-- message -->
<
div>$post[message]</div>
<!-- / 
message --> 
replace with:
PHP Code:
<!-- message -->
<
div>$post[message]<!-- embedded poll -->
<if 
condition="$post[pollresults]">
<
br />
<
br />
$post[pollresults]
</if><!-- 
embedded poll end -->
</
div>
<!-- / 
message --> 
unless of course you want it beneath (possible) attachments, but above the signature, etc etc., then you'd place it there

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 01-30-2005, 05:46 PM
Ianomed's Avatar
Ianomed Ianomed is offline
 
Join Date: Oct 2004
Location: The Netherlands
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hybrid + Threaded mode are now also supported
Reply With Quote
  #13  
Old 02-02-2005, 09:59 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyway to keep the poll embedded when they click on results link? just like if you vote on the poll it will show the results embedded.

edit: nevermind, i already made it... i should stop being lazy
Reply With Quote
  #14  
Old 02-03-2005, 06:34 PM
Ianomed's Avatar
Ianomed Ianomed is offline
 
Join Date: Oct 2004
Location: The Netherlands
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

most excellent
mind sharing it as an addon hack?
Reply With Quote
  #15  
Old 02-03-2005, 08:18 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

in showthread.php find:
PHP Code:
'posted'    => INT
replac with:
PHP Code:
    'posted'    => INT,
    
'viewpoll' => INT
still in showthread.php, find three instances of:

PHP Code:
if ($showresults OR $uservoted
replace with:
PHP Code:
if ($showresults OR $uservoted OR $viewpoll
edit template poll > polloptions_table

find:
HTML Code:
<a href="poll.php?$session[sessionurl]do=showresults&amp;pollid=$pollinfo[pollid]">$vbphrase[view_poll_results]</a>
replace with:
HTML Code:
<a href="poll.php?$session[sessionurl]t=$thread[threadid]&amp;viewpoll=1">$vbphrase[view_poll_results]</a>
you can make it part of your orginal hack... i dont care.
Reply With Quote
  #16  
Old 06-10-2005, 06:49 PM
dsboyce8624 dsboyce8624 is offline
 
Join Date: May 2005
Location: New Jersey
Posts: 413
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could this be combined with the hack that keeps the first post on every page?
Reply With Quote
Reply


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 02:32 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06117 seconds
  • Memory Usage 2,324KB
  • Queries Executed 22 (?)
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
  • (14)bbcode_php
  • (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
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (5)postbit
  • (6)postbit_onlinestatus
  • (6)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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • 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