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-04-2005 10:00 PM

First post on every page of thread.
 
I had a use for it, so I thought I would share it.

Requires no file edits (Thanks Kirby!).
Adds no quarys when viewing threads :)

This is something like here on vbulletin.org , it allows you to select forums where the first post of the thread is shown thru out the thread.

It uses stock template looks now , if someone wishes to make a template and share it feel free.

I will offer support as I can.

Ps. If you install this hack please click the install :nervous:

Templates for first post:
https://vborg.vbsupport.ru/showpost....&postcount=124
https://vborg.vbsupport.ru/showpost....&postcount=161

Asterik 08-05-2005 09:54 PM

Oh man, just what I needed. I couldn't wait for it to be ported! :D Thanks ALOT :).

vBintense 08-05-2005 09:56 PM

Quote:

Originally Posted by Asterik
Oh man, just what I needed. I couldn't wait for it to be ported! :D Thanks ALOT :).

No trouble at all, I take it the install worked easy ? First hack release so nervious lol

Barakat 08-05-2005 10:02 PM

wowow thats what i was waitting for

Asterik 08-05-2005 10:04 PM

For some reason, it won't work with Geshi. It'll give me this: http://www.programmersforums.com/sho...hp?p=51#post51

vBintense 08-05-2005 10:05 PM

Did you add the new template ?

Asterik 08-05-2005 10:08 PM

Quote:

Originally Posted by insane-topics
Did you add the new template ?

Im so embarrassed :( lol.

::EDIT:: it works flawlessly, thank you :).

vBintense 08-05-2005 10:11 PM

Quote:

Originally Posted by Asterik
Im so embarrassed :( lol.

::EDIT:: it works flawlessly, thank you :).

It happens ;) , I just refreshed that links and looks as though that solved the issue. And most welcome, glad others can use it (and the instructions worked lol)

Asterik 08-05-2005 11:11 PM

It seems that the template is uncached because if you goto: http://www.programmersforums.com/sho...hp?p=51#post51 and scroll to the bottom, it seems to be adding a query?

::EDIT:: it says this only for me but:

Page generated in 0.20585 seconds with 10 queries (1 queries for uncached templates)
Uncached templates: postbit_first (1)

vBintense 08-05-2005 11:24 PM

Ok , I am looking into it now (I know how to do it hard code, but I will find the plugin and update it with update instructions in a few)

Asterik 08-05-2005 11:26 PM

Quote:

Originally Posted by insane-topics
Ok , I am looking into it now (I know how to do it hard code, but I will find the plugin and update it with update instructions in a few)

Thanks, the plugin system confuses me alot but... yea it can be done hard coded easily enough.

vBintense 08-05-2005 11:59 PM

Update on a small problem with template cache ,I fixed the zip if you already downloaded you can use this xml in 'plugins' not in product and it will fix it.

Barakat 08-06-2005 02:10 AM

what about the attachments ! hope u do it soon

vBintense 08-06-2005 02:11 AM

Attachments should show in the first post (if it had attachments) I will go check.

vBintense 08-06-2005 02:24 AM

Quote:

Originally Posted by Barakat
what about the attachments ! hope u do it soon

Fixed the zip and if you installed already here is the change (thanks for pointing it out)

open showthread.php find
PHP Code:

     if($forum['showfirstpost']==1){
    
$postids "post.postid IN (0" ", " $thread['firstpostid'] . $ids ")";
    } 

Delete it, then find
PHP Code:

$postids "post.postid IN (0" $ids ")"

before it add
PHP Code:

if($forum['showfirstpost']==1){ $ids =  $ids ', ' $thread['firstpostid'];} 

Done now attachments work :)

Boofo 08-06-2005 02:35 AM

The file edit can't be done via a plug-in?

vBintense 08-06-2005 02:37 AM

None that I have found effective. If you look at the showthread.php you will find no hooks inbetween where it 'has' to be called with out adding a quary.

So I went with this option one line of code adding is better then one quary ;)

Boofo 08-06-2005 02:38 AM

Maybe Kirby will come to the rescue. ;)

vBintense 08-06-2005 02:39 AM

/me hides from the all knowing Kirby

But I still think one line added is not too bad, yet if someone can offer a more viable solution using hooks I am willing to listen.

Boofo 08-06-2005 02:42 AM

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

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.

vBintense 08-06-2005 02:57 PM

I will try that in a bit , but looking at the second hook code it looks like should be
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']);
    


With the first if being closed right off, other wise if it is not a show first post it would not show attachments on normal threads?

Andreas 08-06-2005 03:01 PM

Edited my last post.
The first Hook was missing a check for $forum['showfirstpost']

vBintense 08-06-2005 03:02 PM

kk , may I use your change in my update later?

Andreas 08-06-2005 03:04 PM

Feel free to do whatever you want with the Code :)

vBintense 08-06-2005 03:14 PM

Many thanks (will test it out, then update once I am more awake).

[high]* vBintense bows down to Kirbys hook knowledge and gets ready to invite boofo back into the thread
[/high]

;)

vBintense 08-06-2005 05:40 PM

Update: Thanks to Kirby the file edit is no longer needed, if you have installed before now just simply remove the file edit and upload this xml to 'plugins' not to products.

Now that this does not use file edit maybe a mod can move it to plugins?

The zip has been updated with the new product.

Andreas 08-06-2005 05:47 PM

Moved :)

vBintense 08-06-2005 05:48 PM

I tryed it , via the plug in, they connect to the product (looking at the plugin xml) so it should all tie in should it not?

Andreas 08-06-2005 05:50 PM

Yes. AFAIK older Versions did not export the Product, but this XML contains it and therefore they will attach. Already removed the sentence from my last Post before you posted ;)

vBintense 08-06-2005 05:52 PM

I posted to fast then !! :)

Thanks for moving it Kirby , also for teaching me something new about plugins :)


All times are GMT. The time now is 10:57 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.01678 seconds
  • Memory Usage 1,853KB
  • 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
  • (8)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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