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
  #12  
Old 03-03-2002, 06:11 AM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmmm. k thanks
Reply With Quote
  #13  
Old 03-03-2002, 06:11 AM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Also you might want to use this regular expression to modify the pagetext-- it will remove the vBCode for a cleaner display:

PHP Code:
$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]); 
HEY THIS PHP PARSER IS EATING MY REGEX..... do not use the above code.. I'm leaving it there to point out a flaw in vB's php code thingy... here is the correct regex

$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]);

(notice the slashes)
Reply With Quote
  #14  
Old 03-03-2002, 08:33 AM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quotes also screw up the preview.. so I'm using these two lines to clean up the display:

$thread[pagetext]=preg_replace("/\[[^\]]*\]/","",$thread[pagetext]);
$thread[pagetext]=str_replace("\"","",$thread[pagetext]);
Reply With Quote
  #15  
Old 03-03-2002, 12:44 PM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nick:

I had tried to use something like this originally when I wrote this but the extra queries to the database on my large board just about brought it to its knees. So Bira, Chen and wluke came up with the coding to use, as is included with the original hack I wrote, so that it doesn't take up some much in the way of system resources. Either way will work. Thanks for posting another way of doing this.

You might want to have Chen, Bira or wluke to look over the code this code too to see what they think.

Parker
Reply With Quote
  #16  
Old 03-03-2002, 12:45 PM
Parker Clack Parker Clack is offline
 
Join Date: Oct 2001
Posts: 351
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Overgrow:

Those two lines didn't remove any of the quotes from the text preview. The UBB code is removed though now.

Parker
Reply With Quote
  #17  
Old 03-03-2002, 02:05 PM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Parker, great idea for a hack.

I do believe that the JOIN is the way this should be done. It may never work properly with dot-icons since they both want to join the same query, but this is definitely the most efficient way-- there is no duplicate DB data in the thread table and it does not add 50 extra queries with each forumdisplay.

re: quotes... those two lines I put up above, the preg_replace and str_replace do work for me. The first removes vBCode and the second removes quotes. The second is very simple.. replace a quote with nothing, it works for me just fine.
Reply With Quote
  #18  
Old 03-03-2002, 03:20 PM
Freddie Bingham's Avatar
Freddie Bingham Freddie Bingham is offline
 
Join Date: Oct 2001
Posts: 506
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe this will help you out a bit
Code:
SELECT DISTINCT post.userid, post2.pagetext as pagetext, icon.title as icontitle,icon.iconpath, 
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postuserid, 
lastposter,thread.dateline,views,thread.iconid, 
notes,thread.visible,sticky,votetotal,attach 
FROM thread 
LEFT JOIN icon ON (icon.iconid = thread.iconid) 
LEFT JOIN post ON (thread.threadid = post.threadid AND post.userid = '1')
LEFT JOIN post AS post2 ON (thread.firstpostid = post2.postid) 
WHERE thread.threadid IN (0,13,16) 
ORDER BY sticky DESC, lastpost DESC
Reply With Quote
  #19  
Old 03-03-2002, 03:28 PM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

BRILLIANT. I had no idea you could do that

nick, this is definitely possible to do with a JOIN and not have redundant info in the DB and not add any more queries and have it work with doticons. Yell if you want ideas on putting it all together.
Reply With Quote
  #20  
Old 03-03-2002, 03:29 PM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ps. this would be a great feature for v3. I expect it to actually cut bandwidth as people stop clicking on posts that don't really interest them.
Reply With Quote
  #21  
Old 03-03-2002, 05:09 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this has gotten over my head

i get errors with freddie's ('cause of the dotqueries thing?)...and the guy that hosts my site doesn't know what dotqueries are...and i'm not sure exactly what to tell him.
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 04:43 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.04692 seconds
  • Memory Usage 2,303KB
  • 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
  • (1)bbcode_code
  • (1)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
  • (3)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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