SELECT user.user_id, user.username, COUNT(*) AS count
FROM xf_post AS post
INNER JOIN xf_user AS user ON
(post.user_id = user.user_id)
WHERE post.message_state = 'visible'
AND post.post_date > (UNIX_TIMESTAMP() - (7 * 86400))
AND (user.is_moderator = 1 OR user.is_admin = 1)
GROUP BY user.user_id
ORDER BY count DESC