vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Last post on forum home, working version (https://vborg.vbsupport.ru/showthread.php?t=28561)

Austin Dea 08-01-2002 11:59 PM

It's not your fault it doesn't work...

It works fine, but I can't restrict the length so it's messing my tables up.

Boofo 08-02-2002 12:09 AM

have you tried using space.gif to make all of the last post boxes the same length? When they are not joined, this is what you have to do. :)

Austin Dea 08-02-2002 12:41 AM

Well I don't want it as big as it is in the first place =P.

Austin Dea 08-04-2002 08:26 PM

Bah, sorry guys. I figured out hwy it wasn't working. I missed this step...

PHP Code:

look for
      if (!
$hideprivateforums) {
        
$forumperms['canview']=1;
      }

*
above it add
$trueperm
['canview'] = $forumperms['canview']; 

Geez...sorry for all the confusion. It works perfectly fine on 2.2.6.

Tim Wheatley 08-12-2002 08:17 PM

Um... reading through this I'm lost... what works - what doesn't - on 2.2.6?

Austin Dea 08-13-2002 03:30 AM

It works on 2.2.6.

Frank 08-13-2002 10:26 AM

Nice hack

dwh 08-15-2002 03:36 AM

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>&nbsp;<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.

Boofo 08-15-2002 07:06 PM

Can you supply a screenshot?

Webmasta XT 08-16-2002 04:44 PM

damn, when editing admin/functions.php in vb 2.2.6

PHP Code:

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

      $lastposts
=$DB_site->query_first("SELECT lastpost,lastposter,title FROM thread WHERE lastpost='$lastposts[lastpost]'");
                        
$lastpost=$lastposts['lastpost'];
                        
$lastposter=$lastposts['lastposter'];
                        
$lasttitle=$lastposts['title']; 

That part is not possible, so I can't install the hack.. any help with this?


All times are GMT. The time now is 09:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01600 seconds
  • Memory Usage 1,795KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (2)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete