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
  #2  
Old 03-03-2002, 05:28 AM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

HEY that is really nice. I like it, flawless installation and very simple code.

I don't like that it adds a query on the post table for each thread listed.. that's an extra 40 or 50 queries with each forumdisplay. Is it possible to compile a list of all threads that will be displayed on the page and then run one query and pull all the post info at once?

Right now I have it only operating for admins since I don't want to add so much extra load. Thanks, nice work.
Reply With Quote
  #3  
Old 03-03-2002, 05:31 AM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

as far as i know, the choices are a) store the same data twice for every single thread or b) run a few extra queries!

maybe someone can prove me wrong or i can ponder it for awhile
Reply With Quote
  #4  
Old 03-03-2002, 05:39 AM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah...looking at it, i'm almost positive the only way is to run extra queries
Reply With Quote
  #5  
Old 03-03-2002, 05:52 AM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nope, a join will do it. I've got it re-written..

old way: mysql things 1.10 seconds
new way: mysql things 0.09 seconds

Only problem is it joins the post table again which won't work if you have dotqueries turned on. It will take a little more re-writing to get it to work with dotqueries.

PHP Code:
// HACK POST PREVIEW
if($bbuserinfo['usergroupid']==and $showposts!="off") {
    
$previewselect="post.pagetext as pagetext,";
    
$previewjoin="LEFT JOIN post ON (thread.firstpostid = post.postid)";
}
// END PREVIEW

$threads=$DB_site->query("
SELECT 
$dotuserid $votequery $previewselect ".iif($foruminfo[allowicons],
'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
    "
.iif($foruminfo[allowicons],'LEFT JOIN icon ON (icon.iconid = thread.iconid)','')."
    
$dotjoin $previewjoin
    WHERE 
$threadids
    ORDER BY sticky DESC, 
$sortfield $sqlsortorder
    "
); 
Then reference thread[pagetext] down below instead of running the query each time. Works like a charm without the extra db overhead, but like I said, will take a little tweaking to get it to go with dotqueries.
Reply With Quote
  #6  
Old 03-03-2002, 05:54 AM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You want to finish it up?
Reply With Quote
  #7  
Old 03-03-2002, 05:55 AM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

okay...thanks...i'll test that out and issue an update
Reply With Quote
  #8  
Old 03-03-2002, 06:02 AM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well....i got a database error. i must have done something wrong.
Reply With Quote
  #9  
Old 03-03-2002, 06:06 AM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Database error in vBulletin 2.2.2:

Invalid SQL:
SELECT DISTINCT post.userid, post.pagetext as pagetext, icon.title as icontitle,icon.iconpath,
thread.threadid,thread.title,lastpost, forumid,pollid,open,replycount,postusername,postus erid,
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 ON (thread.firstpostid = post.postid)
WHERE thread.threadid IN (0,13,16)
ORDER BY sticky DESC, lastpost DESC

mysql error: Not unique table/alias: 'post'

mysql error number: 1066

Date: Sunday 03rd of March 2002 03:08:13 AM
Script: http://www.60schevytrucks.com/forums...p?s=&forumid=6
Referer: http://www.60schevytrucks.com/forums...s=&threadid=13
Reply With Quote
  #10  
Old 03-03-2002, 06:09 AM
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yup, you have dotqueries turned on. Go to your admin Cpanel and turn off "Use dot icons" -- I did point that out as a problem in my previous post It is trying to join the post table twice. You'll have to write an exception to check if dotqueries is turned on and if it is, change the join again.

I don't use the dots since I didn't think the join was worth it.. but for me, the join is worth it for the preview.
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:26 AM.


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.04310 seconds
  • Memory Usage 2,303KB
  • 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
  • (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
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)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