Description: Adds a link to the My Home screen of the user which leads to a new screen with post statistics per year, month, day, day of the week and hour. There is an admin page which gives the same statistics as a total and per board.
Working Under: UBB.Threads 6.3-6.4
Mod Status: Finished
Any pre-requisites: None
Author(s): dimopoulos
Date: 08/31/03
Credits: PhotoPost (Michael) for the Day of the Week addition
New Files: images/bluebar.jpg, templates/default/myhomestats.tmpl, myhomestats.php, admin/adminpoststats.php
Database Altered: No
Info/Instructions: Very easy modification to install. It should work on previous versions of .threads although I haven't tested it.
Disclaimer: Please backup every file that you intend to modify. If the modification modifies the database, it's a good idea to backup your database before doing so.
Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.
Since we're on the subject... do you think you could make an admin area of this, to give the same statistics, but for everyone? As an admin, I would like to see the posting trends like this, such as what month is the most active, what time of day are people posting the most, etc.
It would seem that it could be done by just modifying the queries a bit, which could take a long time to do if you have a lot of members and a lot of posts. But it would be fun to see
I changed the template a bit to cater for what Jeremy showed earlier and also added a new admin stats page which gives the same information but as a total for the whole forum and per board. It might be intensive to the database since there are 4 queries per board plus another 4 queries for the totals but this will only be used by admins so I think it is OK.
As for the admin stats... took about a minute to generate the stats, but very cool!!
One quick typo... for the admin stats, your last "Total" stats window says posts per month again.. when that one should be posts per hour Otherwise looks perfect
How about Dow Of Week so you see what day of the week is most popular?
Calculations based on a day number within a month isnt as useful to me as knowing which days of the week are most active, so I swapped out that section with:
Code
// Totals in Days <br /> $strQuery = " <br /> SELECT left(date_format(FROM_UNIXTIME(B_Posted),'%W'),3) AS DayLiteral, <br /> dayofweek(FROM_UNIXTIME(B_Posted)) AS DayStat, <br /> COUNT(B_Number) <br /> FROM {$config['tbprefix']}Posts <br /> WHERE B_PosterId = '$Uid' <br /> GROUP BY DayStat <br /> ORDER BY DayStat ASC"; <br /> <br /> $sth = $dbh->do_query($strQuery); <br /> <br /> $intCounter = 0; <br /> <br /> while (list($Day, $DayNum, $Posts) = $dbh->fetch_array($sth)) { <br /> $aTotalDays[$intCounter]['Day'] = $Day; <br /> $aTotalDays[$intCounter]['Posts'] = $Posts; <br /> $intCounter++; <br /> }
Which basically rewrites the query and then uses the same format as the month display.
Maybe I have done something wrong - but I can't see where - but if I try the admin version it times out fairly quickly if I try and load it in the mainframe - but if I open it in a new window it will take ages before timing out - and the server load increases from 0.13 to over 2.10
Th end user one runs fine.
Got 50+ users online whislt I try this. But the server is fairly powerful - so that should not affect things.
It might be the number of boards you have also Ian. The admin page has 4 queries for the totals and 4 x No of Boards queries for the rest of them so for 10 boards you will end up with 44 queries in the database and 44 for loops to display the data.
I will see if I can split the admin section so that it doesn't kill any servers.
Ian, server load will spike tremendously when you do this, especially on a larger forum with a lot of users/posts. Mine took a little over a minute before I got the results, and server loads were well over 2 while running it.
[]dimopoulos said: It might be the number of boards you have also Ian. The admin page has 4 queries for the totals and 4 x No of Boards queries for the rest of them so for 10 boards you will end up with 44 queries in the database and 44 for loops to display the data.
I will see if I can split the admin section so that it doesn't kill any servers. [/]
LOL - only 600 groups & 350 categories
Seriously - do not worry about my set-up - it is not exactly the norm
No I do worry because it might be just an admin feature but if it is going to kill the server even for a minute it is not good. I will sort something out. I have some ideas for additional statistics and would like to split them out. I am also thinking of making a printable page out of them
Let me work something out before the weekend. You can see very clearly the trends on each time interval
User stats work fine in 6.5.1 - albeit you will have to alter the path for main.inc.php to
// Require the library require ("./includes/main.inc.php");
Admin stats are not working - but this maybe my server (as per my post above (can't recall if admin stats ever worked for me)) and not a problem with the code.
Also on the admin side - the menu system has altered so the menu changes need to be in admin_adminmenu.tmpl.
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.