PDA

View Full Version : Restrict a Thread depending on users' posts


nautiqeman
01-08-2005, 09:25 PM
I'd like to be able to restrict a Thread from being seen/posted in/etc based on how many posts I user has done. For example under my main forum thread I'll have a thread title '100K' -- I'd only like those users that have 100k posts or more to even see that. How can I do this? Thanks in advance.

Tekton
01-09-2005, 10:01 AM
Hello. I was pretty bored tonight/this morning so I thought I'd play around with this idea. Here's what I did so far:

Step 1 - Made `req_posts` field (INT, default=0) in THREAD table. (database)

### FOLLOWING DONE IN FORUMDISPLAY.PHP ###

Step 2 - Added req_posts into the thread query
$threads = $DB_site->query("SELECT [...], req_posts, [...]------
Step 3 - Find:
while ($thread = $DB_site->fetch_array($threads))
{ // AND $counter++<$perpage)
Add AFTER
$bbuserinfo['posts']+=1; // min post count requirment minimum | line 1
if($bbuserinfo['posts']>=$thread['req_posts']){ // min post count requirment minimum | line 2-------
Step 4 - Find:
eval('$threadbit .= "' . fetch_template('threadbit') . '";');
}
Add AFTER
} // min post count requirment minimum | line 3 | last line------
------
That should prevent them from showing up in the forum display... which is a start, eh? If you're wondering about the +1 to the bbuserinfo[posts], it seems to error out my way for GUESTS and users not logged in, not that adding one to that is a HUGE deal; it's just one extra line of code and doesn't actually add to the post count. Maybe someone knows a better way?

nautiqeman
01-09-2005, 01:34 PM
So I'm guessing that somewhere in the AdminCP you'll set up the req_posts?

Will this still display the thread in the list though??

Tekton
01-09-2005, 01:49 PM
Oooooh, you want users to SEE the thread but not be able to access it? Well, if that's the case, you can disregard anything after step 1. :P

It could be configurable in the admin panel if you added some code there to do it with.

More code is needed for when they actually visit the thread, I just didn't do that part. (yet?)