Форуми / Cotonti / Extensions / Help on a plugin that shows top posters

Trustmaster
#35044 31.07.2012 18:11

The users table does not keep history information, so you cannot extract statistics for a given time span. Instead, the information should be extracted from the forum posts table. The query for top 10 posters for the last 7 days looks like this:

SELECT u.user_id, u.user_name, u.user_avatar, COUNT(p.fp_id) AS count
    FROM `$db_forum_posts` AS p
        LEFT JOIN `$db_users` AS u ON p.fp_posterid = u.user_id
    WHERE fp_creation > UNIX_TIMESTAMP() - 7*24*3600
    GROUP BY fp_posterid
    ORDER BY count DESC
    LIMIT 10
May the Source be with you!