This method is part of Theia's Stats class.
Purpose: To determine the most chatter box messages one (or all) member(s) have written in any given number of hours.
Arguments: (str) user, (int) hours
Return Value: (str) the most messages the specified user has written in the specified number of hours || (array) an associative array containing the user's name (as its index) and the most messages they wrote as its value
Usage: This method too can be used to check for a single user (as the first argument) or for all members on the site. Since both arguments are optional, you may not even enter the number of hours; in which case the default of 1 hour is used. Here is how we would figure out the most message the user Lev has written in the chatter box during a one hour period:
PHP CODE
$num = Stats::MostCBMessagesWithin('lev', 1);
As you can probably see now, when you specify the user (the first argument) a string (the user's ID) is returned, whereas if you perform this method on all members, an associate array is returned. Here's an example of checking all members for a 3 hour period:
PHP CODE
$stats = Stats::MostCBMessagesWithin(null, 3);
$levscount = $stats['lev'];
Here's an example of running through the array, member by member and performing some arbitrary check to see if they posted more than 10 messages in one hour (which, remember now, is the default number of hours):
PHP CODE
$stats = Stats::MostCBMessagesWithin();
foreach ($stats as $i => $v)
{
if ($v >= 10) { /* do something here for user: $i */ }
}






