PDA

View Full Version : Last Active Thread for 2.01


fastforward
06 Jun 2001, 04:58
This is for vB 2.01

This is new thread as there seems to be a problem with editing attachments on old posts.

This little hack allows the display of the last active thread on the forums pages. This is the 'UBB like' feature. You can see an example at http://dbforums.com.

NOTES
It requires two extra column to be added in the forum table a few code additions and then the thread title and iconid can be referenced using the variables $forum[lastactivethread] and icon$forum[lastactiveiconid].gif. Instructions are in the attachment.

This was originally part of my usenet hack and due to popular request ( all two of them :D ) I'm releasing it seperately.

furious
06 Jun 2001, 10:08
nice hack
but may we have one which works with vb 2.0.0?

h4p3
06 Jun 2001, 11:18
I think it works with vb 2.0.0, try it ;)

Nicholas Brown
06 Jun 2001, 13:43
Originally posted by furious
nice hack
but may we have one which works with vb 2.0.0?

Just download 2.0.1 from the members area

nuno
06 Jun 2001, 16:47
nuno waves at fastfoward :D
tx;)

h4p3
06 Jun 2001, 17:16
fastforward:

It still doesn't do what it should, because it isn't very usefull if you move a topic into another forum then the title of the moved topic isn't showing up in the new forum if you refresh. The old Topic in the forum where it shouldn't be is still showing up but links to the next Topic after the one which was moved. I hope u know what i mean :)

The same thing if you delete a topic. What did you change?

Tolitz
06 Jun 2001, 17:35
But isn't active topics considered to be topics that have recently been posted or replied to? Moving a thread to another forum doesn't necessarily signify that the thread is "active" unless someone replies to it. So IMHO the script is doing what it is supposed to do, which is pull "active" topics...

Then again, I may be wrong ;p

h4p3
06 Jun 2001, 17:38
Nope, if you delete a thread then the titel of the deleted thread is still showing up and links to the next thread. Try it out, it is confusing for users.

fastforward
06 Jun 2001, 18:58
Originally posted by h4p3
fastforward:

It still doesn't do what it should, because it isn't very usefull if you move a topic into another forum then the title of the moved topic isn't showing up in the new forum if you refresh. The old Topic in the forum where it shouldn't be is still showing up but links to the next Topic after the one which was moved. I hope u know what i mean :)

The same thing if you delete a topic. What did you change?
As I said before. The hack will re-calculate the latest active thread only when the thread is re-indexed. I'm not going to over-complicate this by taking into account every rare possibility. The same goes for editing the thread title. If vB doesn't re-index, then the active thread will not change; simple as that.

The change with this version is the displaying of icons.

h4p3
06 Jun 2001, 19:08
Ah ok, thx for the info!

NanoEntity
08 Jun 2001, 16:54
Where do I ADD THIS, I dont get the instructions, help!!!

a) admin/functions.php

OLD_CODE
--------
No old code to replace. ADD the new code just before the closing brace of the indexpost() function.

NEW CODE
--------
// START LAST ACTIVE THREAD HACK
update_last_active_thread(0,$post[threadid],0);
// END LAST ACTIVE THREAD HACK



// ###################### Start indexpost #######################
function indexpost($postid,$firstpost=-1) {

global $DB_site,$bbadminon,$minsearchlength,$maxsearchlength;
global $firstpst,$badwords,$incp;

if (!is_array($badwords)) {
if ($incp) {
include("./badwords.php");
} else {
include("./admin/badwords.php");
}
}

nuno
08 Jun 2001, 17:24
// ###################### Start indexpost #######################
function indexpost($postid,$firstpost=-1) {

global $DB_site,$bbadminon,$minsearchlength,$maxsearchlength;
global $firstpst,$badwords,$incp;

if (!is_array($badwords)) {
if ($incp) {
include("./badwords.php");
} else {
include("./admin/badwords.php");
}
// START LAST ACTIVE THREAD HACK
update_last_active_thread(0,$post[threadid],0);
// END LAST ACTIVE THREAD HACK
}

Raptor
30 Jun 2001, 00:57
oops

Raptor
30 Jun 2001, 00:58
I am seeing a bug. It is consistantly displaying the title of the post one post BEFORE the last post. It worked the first time through, meaning that the first post registered correctly. Now, it is consistantly one behind.

It seems to work perfect when I make a new thread/reply but if left for a while it constantly stays one post behind

whats also weird is that some forums are correct and some are one behind - very VERY strange

check it out and you will see what I mean

I REALLY loved this feature when used to use UBB so was very happy when you rls'd this

any help would be much appreciated (perhaps table indexes are wrong? or the function.php is slightly wrong?)

also how to increase the table width for Last post - i'd like to widen it a bit but i'm totally missing where I should implement the change (doh!)

thanks FF !

http://digital-forums.com/forum/

eurosale
21 Jul 2001, 21:30
I had the same problem. Under certain circumstances vB is not reindexing when replying to a message. This additionl index-call should solve the problem:

Just replace in newreply.php :

indexpost($postid,0);

if ($visible) {
if ($threadinfo[replycount]%10==0) {
$replies=$DB_site->query_first("SELECT COUNT(*)-1 AS replies FROM post WHERE threadid='$threadid'");
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount='$replies[replies]',lastposter='".addslashes($postusername)."' WHERE threadid='$threadid'");
} else {
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount=replycount+1,lastposter='".addslashes($postusername)."' WHERE threadid='$threadid'");
}
}

by:

indexpost($postid,0);

if ($visible) {
if ($threadinfo[replycount]%10==0) {
$replies=$DB_site->query_first("SELECT COUNT(*)-1 AS replies FROM post WHERE threadid='$threadid'");
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount='$replies[replies]',lastposter='".addslashes($postusername)."' WHERE threadid='$threadid'");
} else {
$DB_site->query("UPDATE thread SET lastpost='".time()."',replycount=replycount+1,lastposter='".addslashes($postusername)."' WHERE threadid='$threadid'");
}
indexpost($postid,0);
}

I hope that helps!

ztsky
21 Jul 2001, 23:44
See mine
there's a demo:
http://tsing.com/vb/

I think it's not need to change any table,I get last activetiltle and its icon in edit index.php.

eurosale
22 Jul 2001, 00:08
So please ztsky,

if there are better solutuions, please let us know how! :eek:

ztsky
22 Jul 2001, 00:19
Originally posted by eurosale
So please ztsky,

if there are better solutuions, please let us know how! :eek:

eurosale:
Sorry ,i still have a problem to solve.
I have three sub forums in a main forum.
in my hacked board, the main forumhome lastposttitle always show the main forum's,but the sub forums have newest thread!:rolleyes:

TDawson
22 Jul 2001, 02:27
Originally posted by ztsky


eurosale:
Sorry ,i still have a problem to solve.
I have three sub forums in a main forum.
in my hacked board, the main forumhome lastposttitle always show the main forum's,but the sub forums have newest thread!:rolleyes:
I have the same problem.

I found this out AFTER i installed this hack

ztsky
22 Jul 2001, 02:37
Originally posted by TDawson

I have the same problem.

I found this out AFTER i installed this hack
I didn't use this hack,I write a hack of mine,the effection is same but it's more simple and not need to edit table,but my problem is above i said.

TDawson
22 Jul 2001, 22:42
Don't matter, this hack has too many problems:
1) Doesn't show last post of subforums
2) Is always 1 thread behind.

I'm sure there are more, but i took it off before i could find out...

Reef Board
30 Jul 2001, 02:31
I need some help. I tried installing this hack, ran the queries etc.. and it only displays the icon on the main page.

Even when someone posts a new topic with a different icon the icon on the main page remains the same?

http://www.reefboard.com/cgi-bin/forum

Phil~