Version: 1.00, by N!ck
Developer Last Online: Oct 2008
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!...
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.
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']==6 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.
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
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.