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
  #2  
Old 01-24-2005, 12:39 PM
yoyoyoyo's Avatar
yoyoyoyo yoyoyoyo is offline
 
Join Date: Dec 2004
Location: USA
Posts: 1,612
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

cool idea! I will check it out later! Thanks for sharing.
Reply With Quote
  #3  
Old 01-24-2005, 12:42 PM
Ianomed's Avatar
Ianomed Ianomed is offline
 
Join Date: Oct 2004
Location: The Netherlands
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My pleasure
Reply With Quote
  #4  
Old 01-24-2005, 12:46 PM
nexialys
Guest
 
Posts: n/a
Default

/me check and please!!
Reply With Quote
  #5  
Old 01-24-2005, 12:57 PM
Ianomed's Avatar
Ianomed Ianomed is offline
 
Join Date: Oct 2004
Location: The Netherlands
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Nexy, good to see you around
And nice to see you're pleased with the hack.
Reply With Quote
  #6  
Old 01-24-2005, 01:04 PM
nexialys
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Ianomed
Hey Nexy, good to see you around
And nice to see you're pleased with the hack.
hum.. around ?!... you missed me ?!

yeah, i just applyed the hack, and it's good... i thought to recode it a bit, but it's useless, you worked it out well.

btw, in showthread.php there is 3 "$postbits .= construct_postbit($post, $template);" ... specify what is the one to edit... -- or guys, edit the three, you will have the same setting for all kind of displays (threaded as well)
Reply With Quote
  #7  
Old 01-24-2005, 01:12 PM
Ianomed's Avatar
Ianomed Ianomed is offline
 
Join Date: Oct 2004
Location: The Netherlands
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

lol, indeed. I've been rather busy with work, enjoying a short breather now. As such not been around here much.

About the 3 sequences, I've never used threaded/hybrid mode on any board whatsoever, so it kinda escaped my attention to make it tick for those as well. *whistles*

I'll post an update to include instructions for it shortly, thanks for pointing it out
Reply With Quote
  #8  
Old 01-24-2005, 04:42 PM
Guy G Guy G is offline
 
Join Date: Nov 2004
Posts: 250
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thats fantasitc.
Doing it now for sure.
Reply With Quote
  #9  
Old 01-24-2005, 04:45 PM
Ianomed's Avatar
Ianomed Ianomed is offline
 
Join Date: Oct 2004
Location: The Netherlands
Posts: 112
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks
keep in mind it doesn't work for threaded and hybrid mode, yet.
I'm posting up a revised version that includes instructions for getting that to work too.
Thusfar all admins I asked never use those modes, but you never know
Reply With Quote
  #10  
Old 01-24-2005, 06:05 PM
Skyline_GT Skyline_GT is offline
 
Join Date: May 2003
Location: Vancouver, BC
Posts: 482
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice hack... Might install it later.
Thanks.
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:29 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.04335 seconds
  • Memory Usage 2,346KB
  • 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
  • (10)bbcode_php
  • (1)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
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (8)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
  • 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