View Full Version : Additional Stats
MarkB
11-16-2001, 10:04 AM
I love how we can see a daily/weekly/etc breakdown of how many members/posts/threads we see per period, but would it be possible to have the option to see how many *thread views* we get as well? I think it'd be cool to see which days see heavier traffic through threads themselves.
Or maybe it's just me. Still be cool tho ;)
Admin
11-16-2001, 11:15 AM
Ok, here goes... :)
In stats.php, add this:
echo "<option value=\"views\">Thread Views</option>\n";
right after this code:
echo "<option value=\"thread\">Threads</option>\n";
Now replace this:
if ($type == "thread") {
$table = "thread";
$field = "dateline";
} elseif ($type == "post") {
$table = "post";
$field = "dateline";
} elseif ($type == "user") {
$table = "user";
$field = "joindate";
}
with this:
if ($type == "thread") {
$table = "thread";
$field = "dateline";
$countsql = "COUNT(*)";
} elseif ($type == "views") {
$table = "thread";
$field = "dateline";
$countsql = "SUM(views)";
} elseif ($type == "post") {
$table = "post";
$field = "dateline";
$countsql = "COUNT(*)";
} elseif ($type == "user") {
$table = "user";
$field = "joindate";
$countsql = "COUNT(*)";
}
And last, replace this:
$stats = $DB_site->query("SELECT COUNT(*), DATE_FORMAT(FROM_UNIXTIME($field),'$sqlformat') AS timeframe, MAX($field) FROM $table WHERE $field > '$from' AND $field < '$to' GROUP BY timeframe ORDER BY $field $sort");
with this:
$stats = $DB_site->query("SELECT $countsql , DATE_FORMAT(FROM_UNIXTIME($field),'$sqlformat') AS timeframe, MAX($field) FROM $table WHERE $field > '$from' AND $field < '$to' GROUP BY timeframe ORDER BY $field $sort");
Not tested, but should work. :)
MarkB
11-16-2001, 08:40 PM
Works great! :D Thanks (yet again!) Mr Fly :)
squawell
11-17-2001, 01:27 AM
it's great!!
if we want to add post views or someone forum views what
should i do?
Admin
11-17-2001, 05:52 AM
There is no such thing as post / forum views.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.