I've modified this to work with icons...I tried it briefly but not sure if there are any issues...try it out...but only on a test board...please don't install on a production board until people say they have tested it...hopefully PPN will modify his instructions (I did not bother w/ any version older than 2.2.6 and I had a lot of trouble with this hack..mostly because of the $form['lasttitle'] which has 2 mistakes...$forum[lasttitle] is correct...but nonetheless, very good concept and very well done..thanks for your hard work PPN a+!
Quote:
I installed this hack on a **fresh** vBulletin 2.0.1, though as i'm updating this file i'll tell you i've tested it on 2.0.1, 2.0.2, 2.0.3, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.3b and 2.2.4. This means every version btw :)
first thing to do is to run this mysql query :P
ALTER TABLE `forum` ADD `lasttitle` VARCHAR(100) NOT NULL AFTER `lastposter`
ALTER TABLE `forum` ADD `lasticonid` SMALLINT(5) NOT NULL AFTER `lasttitle`
open /admin/functions.php
-----------------------------
on line 1456 look for
$lastposter='';
below add
//LT HACK
$lasttitle='';
$lasticonid='';
//END HACK
-------
then look for
$getchildforums=$DB_site->query("SELECT forumid,threadcount,replycount,parentlist,parentid ,lastpost,lastposter FROM forum WHERE INSTR(CONCAT(',',parentlist,','),',$forumid,')>0") ;
change to
//LT HACK
$getchildforums=$DB_site->query("SELECT forumid,threadcount,replycount,parentlist,parentid ,lastpost,lastposter,lasttitle,lasticonid FROM forum WHERE INSTR(CONCAT(',',parentlist,','),',$forumid,')>0") ;
//END LT HACK
-------
then look for
$lastpost=$getchildforum[lastpost];
$lastposter=$getchildforum[lastposter];
below add
//LT HACK
if($getchildforum[lasttitle]=='') {
$newtitle=$DB_site->fetch_array($DB_site->query("SELECT * FROM thread WHERE forumid='$forumid' AND lastposter='$getchildforum[lastposter]' AND lastpost='$getchildforum[lastpost]'"));
$lasttitle=$newtitle[title];
$lasticonid=$newtitle[iconid];
}
else {
$lasttitle=$getchildforum[lasttitle];
$lasticonid=$getchildforum[lasticonid];
}
//END LT HACK
-------
then look for
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
change to
//LT HACK
$lastposts=$DB_site->query_first("SELECT lastpost,lastposter,title,iconid FROM thread WHERE lastpost='$lastposts[lastpost]'");
$lastpost=$lastposts['lastpost'];
$lastposter=$lastposts['lastposter'];
$lasttitle=$lastposts['title'];
$lasticonid=$lastpost['iconid'];
//END LT HACK
-------
FOR VB 2.2.x
look for
if ($lastpost!=$currentlastpost) {
$lastpostquery=",lastpost='$lastpost',lastposter=' ".addslashes($lastposter)."'";
} else {
$lastpostquery="";
}
change to
//LT HACK
if ($lastpost!=$currentlastpost) {
$lastpostquery=",lastpost='$lastpost',lastposter=' ".addslashes($lastposter)."',lasttitle='".addslash es($lasttitle)."',lasticonid='$iconid'";
} else {
$lastpostquery="";
}
//END LT HACK
save the file and upload
open /newthread.php
-----------------------------
on line 231 to 233 you should see the following
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($po stusername)."' WHERE forumid IN ($foruminfo[parentlist])");
}
change it to
//LT HACK
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,threadcount=threadcount+1, lastpost='".time()."',lastposter='".addslashes($po stusername)."',lasttitle='".addslashes(htmlspecial chars($subject))."',lasticonid='".addslashes($icon id)."' WHERE forumid IN ($foruminfo[parentlist])");
}
//END LT HACK
save the file and upload
open /editpost.php
-----------------------------
on line 233 to 235 you should see the following
if ($isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."' WHERE threadid=$threadinfo[threadid]");
//$title="";
}
change it to
//LT HACK
if ($isfirst and $title!="" and $postinfo[dateline]+$editthreadtitlelimit*60>time()) {
$DB_site->query("UPDATE thread SET title='".addslashes(htmlspecialchars($title))."' WHERE threadid=$threadinfo[threadid]");
$lastpost=$DB_site->query_first("SELECT * FROM forum WHERE forumid=$threadinfo[forumid]");
if($lastpost["lastpost"]==$threadinfo["dateline"]) {
$DB_site->query("UPDATE forum SET lasttitle='".addslashes(htmlspecialchars($title)). "',lasticonid='".addslashes($iconid)."' WHERE forumid=$threadinfo[forumid]");
}
//$title="";
}
//END LT HACK
save the file and upload
open /newreply.php
-----------------------------
on line 279 to 281 you should see the following
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',last poster='".addslashes($postusername)."' WHERE forumid IN ($foruminfo[parentlist])");
}
change it to
//LT HACK
if ($visible==1) {
$DB_site->query("UPDATE forum SET replycount=replycount+1,lastpost='".time()."',last poster='".addslashes($postusername)."',lasttitle=' ".addslashes(htmlspecialchars($threadinfo[title]))."',lasticonid='".addslashes($iconid)."' WHERE forumid IN ($foruminfo[parentlist])");
}
//END LT HACK
save the file and upload
open /index.php
-----------------------------
ON LINE 91 for Version 2.2.6
look for
//Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder');
CHANGE TO
//LT HACK
//Forum info
$forums=$DB_site->query('SELECT forum.*,icon.title as icontitle,icon.iconpath as iconpath FROM forum
LEFT JOIN icon
ON (forum.lasticonid=icon.iconid)
WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder');
//END LT HACK
look for
if (!$hideprivateforums) {
$forumperms['canview']=1;
}
above it add
//LT HACK
$trueperm['canview'] = $forumperms['canview'];
//END LT HACK
on line 266 to 267 you should see the following
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
$forum['lastposttime']=vbdate($timeformat,$forum['lastpost']);
below there add
//LT HACK
if($trueperm['canview']) {
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}
if ($forum['lasticonid']) {
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
} else {
$icon="<img src=\"images/icons/icon1.gif\">";
}
}
//END LT HACK
save the file and upload
open /forumdisplay.php
-----------------------------
LOOK FOR
//Forum info
$forums=$DB_site->query('SELECT * FROM forum WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder,forumid');
CHANGE TO
//LT HACK
//Forum info
$forums=$DB_site->query('SELECT forum.*,icon.title as icontitle,icon.iconpath as iconpath FROM forum
LEFT JOIN icon
ON (forum.lasticonid=icon.iconid)
WHERE displayorder<>0 AND active=1 ORDER BY parentid,displayorder,forumid');
//END LT HACK
look for
if (!$hideprivateforums) {
$forumperms['canview']=1;
}
above it add
$trueperm['canview'] = $forumperms['canview'];
on line 197 to 198 you should see the following
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
$forum['lastposttime']=vbdate($timeformat,$forum['lastpost']);
below there add
//LT HACK
if($trueperm['canview']) {
$forum['lasttitle']=unhtmlspecialchars($forum['lasttitle']);
if (strlen($forum['lasttitle']) > 30) {
$forum['lasttitle'] = substr($forum['lasttitle'], 0, 28);
$forum['lasttitle'] .= '..';
}
if ($forum['lasticonid']) {
$icon="<img src=\"$forum[iconpath]\" alt=\"$forum[icontitle]\" width=\"15\" height=\"15\" border=\"0\">";
} else {
$icon="<img src=\"images/icons/icon1.gif\">";
}
}
//END LT HACK
save the file and upload
IN THE TEMPLATE, $icon will give you the full icon.
Ok, now to edit the templates, this isn't hard you just have to edit one.
In the control panel go to the "forumhome_lastpostby" template
within it you may add $forum['lasttitle'] to show the last thread title to be posted to, i chose the following format for my board.
<table cellpadding="0" cellspacing="0" border="0" width="100%" id="ltlink"><tr align="right">
<td nowrap><smallfont><a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]">$forum[lasttitle]</a><br>$forum[lastpostdate] <font color="#FF9C58">$forum[lastposttime]</font><br>
by <a href="member.php?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]"><b>$forum[lastposter]</b></a></smallfont></td>
<td nowrap> <a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><img src="https://vborg.vbsupport.ru/images/lastpost.gif" border="0" alt="Go to last post"></a></td>
</tr></table>
After changing the template run Update Forums info, this can be found in the "Update counters..." section of the control panel. This will make the titles appear.
Support can be gained from the vBulletin forums only, any other form of contact will be ignored.
PPN
software@pp-network.com
|
Also, don't miss the fact that I added a new field in forums and the SQL is at the top of the modified instructions.
|