SELECT u.user_id, u.username, COUNT(*) AS 'NumPosts'
FROM xf_post AS p
INNER JOIN xf_thread AS t ON (t.thread_id = p.thread_id)
INNER JOIN xf_user AS u ON (u.user_id = p.user_id)
WHERE 1=1
AND p.message_state = 'visible'
AND t.discussion_state = 'visible'
AND p.post_date > UNIX_TIMESTAMP('2016-10-31')
GROUP BY p.user_id
ORDER BY NumPosts DESC