Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Improved Thread Preview Hack Details »
Improved Thread Preview Hack
Mod Version: 1.00, by N!ck (Member) N!ck is offline
Developer Last Online: Oct 2008 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 2.2.x Rating: (0 vote - 0 average) Installs: 88
Released: 03 Mar 2002 Last Update: Never Downloads: 9
Not Supported  

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

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Forum Display Enhancements Improved Thread Preview TCattitude vBulletin 3.6 Add-ons 11 24 Oct 2011 23:49
Improved Thread Preview 1.5 TCattitude vBulletin 3.5 Add-ons 61 03 Aug 2007 22:56
Improved Thread Preview 1.0 TCattitude vBulletin 3.0 Full Releases 16 18 Apr 2006 23:46

Comments
  #2  
Old 03 Mar 2002, 06:28
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
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.
Attached Images
File Type: gif postpreview.gif (24.2 KB, 1915 views)
Reply With Quote
  #3  
Old 03 Mar 2002, 06:31
N!ck N!ck is offline
 
Join Date: Mar 2002
Real name: Nick...duh
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 Mar 2002, 06:39
N!ck N!ck is offline
 
Join Date: Mar 2002
Real name: Nick...duh
yeah...looking at it, i'm almost positive the only way is to run extra queries
Reply With Quote
  #5  
Old 03 Mar 2002, 06:52
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
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.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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.
__________________
Marijuana Growing Magazine - since vB 1.1
Reply With Quote
  #6  
Old 03 Mar 2002, 06:54
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
You want to finish it up?
__________________
Marijuana Growing Magazine - since vB 1.1
Reply With Quote
  #7  
Old 03 Mar 2002, 06:55
N!ck N!ck is offline
 
Join Date: Mar 2002
Real name: Nick...duh
okay...thanks...i'll test that out and issue an update
Reply With Quote
  #8  
Old 03 Mar 2002, 07:02
N!ck N!ck is offline
 
Join Date: Mar 2002
Real name: Nick...duh
well....i got a database error. i must have done something wrong.
Reply With Quote
  #9  
Old 03 Mar 2002, 07:06
N!ck N!ck is offline
 
Join Date: Mar 2002
Real name: Nick...duh
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,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 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 Mar 2002, 07:09
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
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.
__________________
Marijuana Growing Magazine - since vB 1.1
Reply With Quote
  #11  
Old 03 Mar 2002, 07:11
N!ck N!ck is offline
 
Join Date: Mar 2002
Real name: Nick...duh
hmmm. k thanks
Reply With Quote
  #12  
Old 03 Mar 2002, 07:11
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
Also you might want to use this regular expression to modify the pagetext-- it will remove the vBCode for a cleaner display:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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)
__________________
Marijuana Growing Magazine - since vB 1.1
Reply With Quote
  #13  
Old 03 Mar 2002, 09:33
Overgrow's Avatar
Overgrow Overgrow is offline
 
Join Date: Nov 2001
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]);
__________________
Marijuana Growing Magazine - since vB 1.1
Reply With Quote
  #14  
Old 03 Mar 2002, 13:44
Parker Clack Parker Clack is offline
 
Join Date: Nov 2001
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
  #15  
Old 03 Mar 2002, 13:45
Parker Clack Parker Clack is offline
 
Join Date: Nov 2001
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
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 05:35.

Layout Options | Width: Wide Color: