PDA

View Full Version : you guys already have this hack?


SNA
03-17-2001, 10:58 PM
Its like the UBB look, it shows the last post icon and title for each forum instead of just the username , time and date on the forum front page (index.php) in the LAST POST column.

I can post it if nobody has released it

SNA

03-18-2001, 12:05 AM
:rolleyes:

03-18-2001, 12:20 AM
Ill take that as a 'what the hell are you talking about'

heres what i mean

03-18-2001, 01:01 AM
im sorry, but that seems compleatly useless!
(hey 100 posts)

03-18-2001, 05:44 AM
This is a function my members have been using on my ubb and I would love to have a hack for VB that does it!

Where is it at?

03-18-2001, 09:26 AM
You can do it by editing the templates.
Its easy to do.

03-18-2001, 12:41 PM
You have to hack the templates yes but you need to write code to get the latest title and icon in each forum.

If you can do it without writing a function please let me know.

I can post the hack on how I did it you guys want.

03-18-2001, 01:08 PM
Thank you SNA

I would love to try your hack on my board. waiting ..

03-18-2001, 01:33 PM
EDITED >> 3-18-2001 11:07 AM Central Time
Fixed the Select Statement to take in consideration if the thread was moved or not by looking for open='1'.


Add this code to the bottom of admin/functions.php before ?>



function active_topic($theforumid)
{
global $DB_site;

$activeresult = $DB_site->query("SELECT thread.title,thread.iconid,icon.iconpath FROM thread LEFT JOIN icon ON thread.iconid=icon.iconid WHERE forumid='$theforumid' AND open='1' ORDER BY lastpost DESC LIMIT 1");
$activeresults = $DB_site->fetch_array($activeresult);

return($activeresults);

}



Add this code to index.php


$lastposthome = active_topic($forum[forumid]);
$lastposthome[title] = substr($lastposthome[title],0,40) . "...";
if($lastposthome[iconpath]){
} else {
$lastposthome[iconpath] = "images/icons/icon1.gif";
}


after


if ($forum['lastpost']>0) {
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
$forum['lastposttime']=vbdate($timeformat,$forum['lastpost']);


now add this code to forumdisplay.php


$lastposthome = active_topic($forum[forumid]);
$lastposthome[title] = substr($lastposthome[title],0,40) . "...";
if($lastposthome[iconpath]){
} else {
$lastposthome[iconpath] = "images/icons/icon1.gif";
}


after


if ($forum['lastpost']>0) {
$forum['lastpostdate']=vbdate($dateformat,$forum['lastpost']);
$forum['lastposttime']=vbdate($timeformat,$forum['lastpost']);




Now to get it to show up on you board.


Edit the 'forumhome' template.


replace it with this


<img src="$lastposthome[iconpath]" border=0>
&nbsp;<a href="showthread.php?s=$session[sessionhash]&goto=lastpost&forumid=$forum[forumid]"><smallfont>$lastposthome[title]</smallfont></a>
<smallfont>(by <a href="member.php?s=$session[sessionhash]&action=getinfo&find=lastposter&forumid=$forum[forumid]">$forum[lastposter]</a>)</smallfont>
<br>
<smallfont>$forum[lastpostdate]</smallfont> <smallfont COLOR="#6c6081">$forum[lastposttime]</smallfont>



There you go...

Again, I am new to PHP/MySQL and right now I know how to make things work. Whether its efficient or not, thats another story, im getting there :)

PM me if you have any problems.

03-19-2001, 11:02 AM
LittleBird. Did it work?

03-20-2001, 03:56 AM
Fatal error: Call to undefined function: active_topic() in /home/dlrarmy/public_html/forums/index.php on line 236

I would really like to use this hack~~~~

What am I doing wrong?

03-20-2001, 03:59 AM
You didnt copy the active_topic function to admin/functions.php