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

Reply
 
Thread Tools
Improved Thread Preview Hack Details »»
Improved Thread Preview Hack
Version: 1.00, by N!ck N!ck is offline
Developer Last Online: Oct 2008 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 03-02-2002 Last Update: Never Installs: 88
 
No support by the author.

The idea for this hack was originally that of Parker Clack, a regular here on vBulletin.org.

What this hack does:
Basically, this hack pops up a little box/window when the mouse is run over a thread title that shows the first three hundred characters of the first post in the thread (that is, the post that started the thread).

Improvements to Parker Clack's hack:
  • Far, far less code...
  • Easier installation (one file edit, one template edit)...
  • Less space usage...the beginning of the first post in each thread is not stored twice - only once now!...

Versions:
3.0: Overgrow's search page thread preview instructions.
2.1: Added some necessary instructions.
2.0 Reduced MySQL queries significantly.
1.0 Initial release.

Comments appreciated...

A version for vbHacker is available here - note: some files may need fixing afterward if they present parse errors!

How to Censor Previews (by nakkid)
See page seven of this thread.

A very important security fix is available here - I have not updated the ZIP, so install it after you install the hack

Show Your Support

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

Comments
  #102  
Old 05-09-2002, 03:45 PM
inetd inetd is offline
 
Join Date: Nov 2001
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by inetd
Don't show preview for some threads...
nakkid, please help me with this bug.
Reply With Quote
  #103  
Old 05-09-2002, 07:33 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmmm... i didnt actually look at the search file made by nick, only at the the code i inserted in forumdispaly.php first.
i tested the code listed below in search.php and it worked perfectly for me. here it is what i did...

Find:
Code:
    $sql="
    SELECT $dotuserid $distinct
      thread.threadid,thread.threadid AS postid,thread.title AS threadtitle,thread.iconid AS threadiconid,thread.replycount,
      thread.views,thread.pollid,thread.open,thread.lastpost AS postdateline,thread.lastpost,thread.lastposter,
      forum.forumid,forum.title AS forumtitle,forum.allowicons,attach,
      thread.postusername AS usrname,
      user.userid AS postuserid,
      threadicon.iconpath AS threadiconpath,threadicon.title AS threadicontitle
    FROM
      thread,forum".iif(strpos($search[query],"searchindex")>0,",searchindex","")."
    LEFT JOIN user ON user.username=thread.postusername
    LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
    $dotjoin
REPLACE it with:
Code:
    $sql="
    SELECT $dotuserid $distinct
      thread.threadid,thread.threadid AS postid,thread.title AS threadtitle,thread.iconid AS threadiconid,thread.replycount,
      thread.views,thread.pollid,thread.open,thread.lastpost AS postdateline,thread.lastpost,thread.lastposter,
      forum.forumid,forum.title AS forumtitle,forum.allowicons,attach,
      thread.postusername AS usrname,
      user.userid AS postuserid,
      threadicon.iconpath AS threadiconpath,threadicon.title AS threadicontitle,
      post2.pagetext as pagetext
    FROM
      thread,forum".iif(strpos($search[query],"searchindex")>0,",searchindex","")."
    LEFT JOIN user ON user.username=thread.postusername
    LEFT JOIN icon AS threadicon ON thread.iconid=threadicon.iconid
    LEFT JOIN post AS post2 ON thread.firstpostid=post2.postid
    $dotjoin
Find:
Code:
        // get first 30 chars of post title
        if (trim($searchresult[posttitle])=="") {
          $searchresult[posttitle]=substr($searchresult[pagetext],0,50);
          if (strlen($searchresult[posttitle])>50) {
            $spacepos=strpos($searchresult[posttitle]." "," ",50);
            if ($spacepos!=0) {
              $searchresult[posttitle]=substr($searchresult[posttitle],0,$spacepos)."...";
            }
          }
        }
BELOW this, add:
Code:
        // get first 100 chars of post message
        if (strlen($searchresult[pagetext])>100) {
          $searchresult[message]=censortext(substr($searchresult[pagetext],0,97).'...');
        } else {
          $searchresult[message]=censortext(searchresult[pagetext]);
        }
        $searchresult[message]=preg_replace("/\[[^\]]\]/","",$searchresult[message]); 
        $searchresult[message]=str_replace("\"","",$searchresult[message]);
In 'searchresultbit_threadonly' template, find:
Code:
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords">$searchresult[threadtitle]</a>
REPLACE it with:
Code:
<a href="showthread.php?s=$session[sessionhash]&threadid=$searchresult[threadid]$highlightwords" title="$searchresult[message]">$searchresult[threadtitle]</a>
i personally didnt like the fact that the preview text is not censored, so i added also the censor function. let me know if it worked.
Reply With Quote
  #104  
Old 05-09-2002, 07:38 PM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this was tested in VB225.
i think where most of the people make the mistake is the query change. thare are 2 queries that look almost identical there, in search.php...
btw, there is nothing wrong with nick's file.
Reply With Quote
  #105  
Old 05-09-2002, 11:31 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by nakkid
nick, i think you forgot one little detail.. if the thread is deleted, the previewpostid will still be there. you could do this:

open functions.php and go to [high]deletethread()[/high] function.
find:
Code:
    $DB_site->query("DELETE FROM thread WHERE threadid='$threadid'");
BELOW this, add:
Code:
    $DB_site->query("DELETE FROM thread WHERE firstpostid='$firstpostid'");
let me know what you think.
i'm not sure exactly what more doing this would accomplish...? the first query will delete the whole row, including firstpostid...
Reply With Quote
  #106  
Old 05-10-2002, 12:29 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

you are correct. sorry, i didnt realised.
in other order, you think was a good idea that i added the censortext function?
thanks for the input.
Reply With Quote
  #107  
Old 05-10-2002, 12:48 AM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it's definitely something i didn't think of
Reply With Quote
  #108  
Old 05-10-2002, 02:59 AM
TECK's Avatar
TECK TECK is offline
 
Join Date: Nov 2001
Location: Canada
Posts: 4,182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i'm glad you like it.
Reply With Quote
  #109  
Old 05-10-2002, 12:59 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i'll put this information on post #1
Reply With Quote
  #110  
Old 05-10-2002, 06:52 PM
inetd inetd is offline
 
Join Date: Nov 2001
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

when i inserted
Code:
        // get first 100 chars of post message
        if (strlen($searchresult[pagetext])>100) {
          $searchresult[message]=censortext(substr($searchresult[pagetext],0,97).'...');
        } else {
          $searchresult[message]=censortext(searchresult[pagetext]);
        }
        $searchresult[message]=preg_replace("/\[[^\]]\]/","",$searchresult[message]); 
        $searchresult[message]=str_replace("\"","",$searchresult[message]);
in search.php, i see blank page
Reply With Quote
  #111  
Old 05-12-2002, 11:40 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah?
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 05:34 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.06575 seconds
  • Memory Usage 2,315KB
  • Queries Executed 25 (?)
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
  • (9)bbcode_code
  • (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
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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