No announcement yet.

[Mini-RELEASE 2.x] New Threads Today

  • Filter
  • Time
  • Show
Clear All
new posts

  • [Mini-RELEASE 2.x] New Threads Today

    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.



    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:

    PHP Code:
    // 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'");
    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.

    Last edited by badmeetsevil-; Sun 14 Oct '01, 6:55pm.

  • #2
    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")));


    • #3
      Yes, that's the current coding for this hack. Gotta love it.


      • #4
        I like it~~~

        it's worked.

        thank you very much.


        • #5
          Great little hack, I like these sorts. Thanks.
          HP DL-380 G6, 2x E5520, 28GB RAM, 4x300GB SAS, VMWare ESXi
          Unreal Tournament : Assault forums - irc:// -


          • #6

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


            • #7
              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?


              • #8
                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".


                • #9
                  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...


                  • #10
                    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?


                    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.