vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   First post on every page of thread. (https://vborg.vbsupport.ru/showthread.php?t=93706)

vBintense 08-06-2005 02:43 AM

Quote:

Originally Posted by Boofo
No, sir, it isn't bad at all. But no file edits are even better. ;)

Yes, I agree but no added quary owns all ;)

Boofo 08-06-2005 02:44 AM

Did you really think I wouldn't be ready for this? LOL

But no added query and no file eidt is the best! ;)

vBintense 08-06-2005 02:46 AM

[high]* vBintense kicks boofo out of my thread until he clicks intall !!!
[/high]

I did look though , I may be blind but I could not find a way not to edit the file ;)

Boofo 08-06-2005 02:51 AM

And there may ne no way around it. But if there is a way, Kirby is the one who will find it. ;)

[high]* Boofo will install when the file edit gets taken care of or Kirby can't find a way to do it. ;)[/high]

vBintense 08-06-2005 03:10 AM

[high]* vBintense looks for the all knowing Kirby to point him into this thread :)[/high]

Logikos 08-06-2005 03:27 AM

[high]* Logikos clicks install because I will use this later. File edit or not :)[/high]

chanhlinh 08-06-2005 06:14 AM

Thanks a lot! You're my Hero :)

Andreas 08-06-2005 02:10 PM

Guess what, I hate File Edits :D

Hook: showthread_query
PHP Code:

if ($forum['showfirstpost'])
{
    
$hook_query_where .= " OR post.postid = $thread[firstpostid]";


This does show the first Post on all Pages. However, if it has attachments they will only be shown on the first Page.
Don't think there is a way to get this working too without a File Edit, but i'll take a further look.

Logikos 08-06-2005 02:13 PM

Quote:

Originally Posted by KirbyDE
Guess what, I hate File Edits :D

Hook: showthread_query
PHP Code:

if ($forum['showfirstpost'])
{
    
$hook_query_where .= " OR post.postid = $thread[firstpostid]";



KirbyDE to the rescue!!!!!!one :)

damm, almost :(

Andreas 08-06-2005 02:45 PM

After looking over the Code for a while, I found a solution that also works for Attachments :)

Hook: showthread_post_start
PHP Code:

if ($forum['showfirstpost'] AND $threadedmode == AND $thread['attach'])
{
    
// Backup
    
$thread['hasattach'] = $thread['attach'];
    unset(
$thread['attach']);


Hook: showthread_query
PHP Code:

if ($forum['showfirstpost'])
{
    
$ids .= ",$thread[firstpostid]";
    
$postids "post.postid IN (0" $ids ")"
    if (
$thread['hasattach'])
    {
        
$attachments $db->query_read("
            SELECT dateline, thumbnail_dateline, filename, filesize, visible, attachmentid, counter,
                postid, IF(thumbnail_filesize > 0, 1, 0) AS hasthumbnail, thumbnail_filesize,
                attachmenttype.thumbnail AS build_thumbnail, attachmenttype.newwindow
            FROM " 
TABLE_PREFIX "attachment
            LEFT JOIN " 
TABLE_PREFIX "attachmenttype AS attachmenttype USING (extension)
            WHERE postid IN (-1" 
$ids ")
            ORDER BY attachmentid
        "
);
        
$postattach = array();
        while (
$attachment $db->fetch_array($attachments))
        {
            if (!
$attachment['build_thumbnail'])
            {
                
$attachment['hasthumbnail'] = false;
            }
            
$postattach["$attachment[postid]"]["$attachment[attachmentid]"] = $attachment;
        }      
        
// Restore
        
$thread['attach'] = $thread['hasattach'];
        unset(
$thread['hasattach']);
    }


What it does:
By unsetting $thread['attach'] in showthread_post_start, the original $attachments query will not be executed.
Then the Plugin on showthread_query runs this Query - with the Postid for the First Post and then restores the original Value for further processing.


All times are GMT. The time now is 03:29 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.01336 seconds
  • Memory Usage 1,758KB
  • 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
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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