PDA

View Full Version : New Threads Today


badmeetsevil-
10-10-2001, 10:00 PM
New Threads Today

Summary of Hack
A simple little hack that is very interesting to have on your forums. If installed correctly, it will show how many threads were started that present day, and reset at midnight. If a thread is deleted, it will be taken off the thread count.

Demo
http://www.soaped-up.com/bbs

Installation

Very simple installation. Download, and open index.php from your forums directory. Find a nice spot anywhere in the file, (maybe under // get total posts) and copy + paste the following:

// number of threads today
$datecut = mktime(0,0,0,date("m"), date("d"), date("y"));
$getthreadstoday=$DB_site->query_first("SELECT count(*) AS count FROM thread WHERE dateline>='$datecut'");
$threadstoday=$getthreadstoday[count];

Close the file, and re-upload it to your server.

Go into your Admin Control Panel, open the template "Forum Home" and find the following:

Total Posts: <b>$totalposts</b>

Immediately following that, paste the following..

| New Threads Today: <b>$threadstoday</b>

Go to your forum main, and you'll see it in action! If it's not working, please reply to this stating what's wrong.

Enjoy.

treszoks
10-11-2001, 09:26 PM
I did something similar as a change for the "today's active topics" link. I noticed how it didn't actually show today's active topics, but rather showed the topics from the last 24 hours. Here's the change I made in search.php:

Find this:

$datesql=" AND thread.lastpost>=".(time()-24*60*60);

Replace with this:

$datesql=" AND thread.lastpost>=".(mktime(0,0,0,date("m"), date("d"), date("Y")));

badmeetsevil-
10-11-2001, 10:06 PM
Yes, that's the current coding for this hack. Gotta love it. :)

mem
10-13-2001, 07:22 AM
I like it~~~

it's worked.

thank you very much.

Martz
10-14-2001, 11:23 PM
Great little hack, I like these sorts. :) Thanks.

badmeetsevil-
10-15-2001, 10:37 PM
Thanks :)

I'm trying to make an addon, so it counts how many new posts from individual forums.

Palmer ofShinra
10-27-2001, 06:28 AM
Hmm... doesn't seem to be working right for me...

I copy/pasted it all nice...

And it's half working.

Basically, it doesn't seem to be resetting at midnight. It says we have 903 new threads... less than an hour after midnight. It was at 891 before midnight.
And 856 yesterday.

What's up with it?

badmeetsevil-
10-27-2001, 01:38 PM
Well, you forum is quite big (post/thread) count wise. It's very possible that you've gotten 900 new threads.

..but if you know this is false, check the coding. Make sure that ("SELECT count(*) AS count FROM thread WHERE dateline>='$datecut'");
says "thread" and not "post".

Palmer ofShinra
10-29-2001, 09:07 AM
It's copy/pasted verbatim from your post.

And I know it's counting threads... I did a comparison of Total Posts, Total Threads and "New Threads Today"

I posted a new thread, and then a normal reply.

Went back and checked the numbers.

Total Threads and New Threads Today both went up the exact same number.
Total Posts went up about 15 more than the others.

It IS counting threads.

What it is NOT doing is resetting at midnight.

Right now it says we have 6689 total threads... and 900 new today.

The only problem is... It's 4am server time. (Central Standard)

We don't get 900 threads a day in any day, even if we get attacked by a flooder. And this stretch of time is our slowest by far.

50 new threads a day is impressive. We normally get between 150-200 visitors a day. They do not start many new threads, as a rule.

Basically, something's wrong with the date cutoff...

treszoks
10-29-2001, 01:06 PM
Isn't there already an option in the cp to find out the number of new threads made each day under the "vb stats" link?

Lucky
01-03-2002, 08:04 AM
I'm liking this.

Thanx.

Okiewan
01-03-2002, 07:34 PM
I'd LOVE to have this counting posts rather than threads :)

TaP
01-07-2002, 08:10 PM
I have the same problem here...

New Threads Today: 7163

And I only get like a few hundred views a day...heh

Shenlong
01-20-2002, 03:39 AM
great hack, the more informitive the better

Lucky
01-21-2002, 09:52 AM
Having a little problem here.

The new posts and threads today are the same as the total posts and total threads.

They are not resetting everyday like they should, I think this is the problem.

Any ideas?

Lucky
02-23-2002, 11:27 AM
Works great on 2.2.2

Webmasta XT
07-21-2002, 06:36 PM
Originally posted by Lucky
Having a little problem here.

The new posts and threads today are the same as the total posts and total threads.

They are not resetting everyday like they should, I think this is the problem.

Any ideas?

I have the exact same problem on vb 2.2.6

Destee
08-09-2002, 11:49 PM
Thanks Bad Meets Evil!

Destee

Exo
09-10-2002, 12:21 AM
Originally posted by Palmer ofShinra
It's copy/pasted verbatim from your post.

And I know it's counting threads... I did a comparison of Total Posts, Total Threads and "New Threads Today"

I posted a new thread, and then a normal reply.

Went back and checked the numbers.

Total Threads and New Threads Today both went up the exact same number.
Total Posts went up about 15 more than the others.

It IS counting threads.

What it is NOT doing is resetting at midnight.

Right now it says we have 6689 total threads... and 900 new today.

The only problem is... It's 4am server time. (Central Standard)

We don't get 900 threads a day in any day, even if we get attacked by a flooder. And this stretch of time is our slowest by far.

50 new threads a day is impressive. We normally get between 150-200 visitors a day. They do not start many new threads, as a rule.

Basically, something's wrong with the date cutoff...


same problem here, what can we do?? :(

Exo
09-14-2002, 12:38 AM
hello please help!! :)

CFF RA's
12-21-2005, 09:04 AM
Can it be changed to accustom 3.5.2????

Zachery
12-21-2005, 09:38 AM
Can it be changed to accustom 3.5.2????

Yea, next time try searching in the vB 3.5 forums instead of the vB2.

Look at my profile.