Stats - Top 40 posts by pageviews

Started by ionablue, December 25, 2007, 02:00:22 AM

Previous topic - Next topic

ionablue

Hi

Currently the "more stats" shows some nice score boards

top 10's etc

a) how do i access these score panels directly?

and

b) how can i extend these to show top20 or top40
either in the above scoreboard or on another page etc

SMF shows "Recent Posts" and this can be set to any number

however would be nice also if can show via an url/link

top40 posts by pageviews

or

top40 topics etc

or

top40 topics by replies

would be nice if there was some way to tap into the stats more

Thanks

[SiNaN]

I just tried, it works.

For Poster top 10:

Open:

Quote/Sources/Stats.php

Find:
// Poster top 10.
$members_result = db_query("
SELECT ID_MEMBER, realName, posts
FROM {$db_prefix}members
WHERE posts > 0
ORDER BY posts DESC
LIMIT 10", __FILE__, __LINE__);
$context['top_posters'] = array();
$max_num_posts = 1;
while ($row_members = mysql_fetch_assoc($members_result))
{
$context['top_posters'][] = array(
'name' => $row_members['realName'],
'id' => $row_members['ID_MEMBER'],
'num_posts' => $row_members['posts'],
'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'] . '">' . $row_members['realName'] . '</a>'
);

if ($max_num_posts < $row_members['posts'])
$max_num_posts = $row_members['posts'];
}
mysql_free_result($members_result);

foreach ($context['top_posters'] as $i => $poster)
$context['top_posters'][$i]['post_percent'] = round(($poster['num_posts'] * 100) / $max_num_posts);


Find in this block of code:

LIMIT 10", __FILE__, __LINE__);

Replace:

LIMIT 20", __FILE__, __LINE__);

You can increase the others by the same way.
Former SMF Core Developer | My Mods | SimplePortal

ionablue


Advertisement: