Jungleman
08-05-2002, 05:30 PM
I am working on a hack which breaks down a users posts into forums they have posted in..
Example, if a user has 1000 posts, it shows 500 in Off Topic, 300 in Hardware Support, 150 in Software Support, 50 in Web Design, etc.
So far the hack works great, one little problem-- it shows names of private forums to people who aren't supposed to have access to them, and I want to avoid that.
Here is the query that I am using:
SELECT COUNT(p.postid) AS post_count, f.title, f.forumid FROM forum f, post p, thread t, user u WHERE f.forumid = t.forumid AND t.threadid = p.threadid AND p.userid = u.userid AND u.userid = $userid AND t.visible = 1 GROUP BY f.forumid ORDER BY post_count DESC
How can I eliminate forums NOT accessible to regular users?
BTW, if you wanna run that query on your forum to see how it works, replace $userid with the user ID of your choice.
Example, if a user has 1000 posts, it shows 500 in Off Topic, 300 in Hardware Support, 150 in Software Support, 50 in Web Design, etc.
So far the hack works great, one little problem-- it shows names of private forums to people who aren't supposed to have access to them, and I want to avoid that.
Here is the query that I am using:
SELECT COUNT(p.postid) AS post_count, f.title, f.forumid FROM forum f, post p, thread t, user u WHERE f.forumid = t.forumid AND t.threadid = p.threadid AND p.userid = u.userid AND u.userid = $userid AND t.visible = 1 GROUP BY f.forumid ORDER BY post_count DESC
How can I eliminate forums NOT accessible to regular users?
BTW, if you wanna run that query on your forum to see how it works, replace $userid with the user ID of your choice.