PDA

View Full Version : New Threads Today


badmeetsevil-
11 Oct 2001, 21:05
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
11 Oct 2001, 22:26
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-
11 Oct 2001, 23:06
Yes, that's the current coding for this hack. Gotta love it. :)

mem
13 Oct 2001, 08:22
I like it~~~

it's worked.

thank you very much.

Martz
15 Oct 2001, 00:23
Great little hack, I like these sorts. :) Thanks.

badmeetsevil-
15 Oct 2001, 23:37
Thanks :)

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

Palmer ofShinra
27 Oct 2001, 07:28
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-
27 Oct 2001, 14:38
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
29 Oct 2001, 10:07
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
29 Oct 2001, 14:06
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
03 Jan 2002, 09:04
I'm liking this.

Thanx.

Okiewan
03 Jan 2002, 20:34
I'd LOVE to have this counting posts rather than threads :)

TaP
07 Jan 2002, 21:10
I have the same problem here...

New Threads Today: 7163

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

Shenlong
20 Jan 2002, 04:39
great hack, the more informitive the better

Lucky
21 Jan 2002, 10:52
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
23 Feb 2002, 12:27
Works great on 2.2.2

Webmasta XT
21 Jul 2002, 19:36
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
10 Aug 2002, 00:49
Thanks Bad Meets Evil!

Destee

Exo
10 Sep 2002, 01:21
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
14 Sep 2002, 01:38
hello please help!! :)

CFF RA's
21 Dec 2005, 10:04
Can it be changed to accustom 3.5.2????

Zachery
21 Dec 2005, 10:38
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.