ThorstenA
03-19-2010, 08:28 AM
This query displays the most participating users from actual forum - you can place it in plugin forumdisplay_start:
SELECT user.userid, user.username, count( * ) AS postcount
FROM user, post, thread,
(SELECT " . $foruminfo[forumid] . " AS forumid UNION
SELECT forumid
FROM forum
WHERE parentlist LIKE \"%," . $foruminfo[forumid] . ",%\"
) AS tmp_a
WHERE thread.forumid = tmp_a.forumid
AND user.userid = post.userid
AND post.threadid = thread.threadid
GROUP BY user.username
ORDER BY postcount DESC
LIMIT 5
SELECT user.userid, user.username, count( * ) AS postcount
FROM user, post, thread,
(SELECT " . $foruminfo[forumid] . " AS forumid UNION
SELECT forumid
FROM forum
WHERE parentlist LIKE \"%," . $foruminfo[forumid] . ",%\"
) AS tmp_a
WHERE thread.forumid = tmp_a.forumid
AND user.userid = post.userid
AND post.threadid = thread.threadid
GROUP BY user.username
ORDER BY postcount DESC
LIMIT 5