vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Restrict a Thread depending on users' posts (https://vborg.vbsupport.ru/showthread.php?t=74024)

nautiqeman 01-08-2005 09:25 PM

Restrict a Thread depending on users' posts
 
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
PHP Code:

$threads $DB_site->query("SELECT [...], req_posts, [...] 

------
Step 3 - Find:
PHP Code:

while ($thread $DB_site->fetch_array($threads))    
// AND $counter++<$perpage) 

Add AFTER
PHP Code:

$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:
PHP Code:

eval('$threadbit .= "' fetch_template('threadbit') . '";');


Add AFTER
PHP Code:

// 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?)


All times are GMT. The time now is 01:22 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00998 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (5)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete