vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Hack to block posting unless you have x # of posts? (https://vborg.vbsupport.ru/showthread.php?t=60653)

deaconxgp 01-24-2004 02:42 AM

Hack to block posting unless you have x # of posts?
 
Is there a hack or way to have a forum set so that the user must have a set # of posts in order to post in that particular forum?

assassingod 01-24-2004 07:57 AM

This has been released. Try searching and you'll find it:)

deaconxgp 01-26-2004 12:11 PM

I've run a search already and there were some similar hacks but they were all for v. 2.2 . I'm running v. 2.3.4.

The similar ones I saw restricted the ability to reply to threads and not necessarily make threads....

Can you point me to the version that works with 2.3.4?

Zachery 01-26-2004 12:12 PM

you should be more clear


if you made a hack that did what you really wanted it to

no user could ever post ever :)

Velocd 01-26-2004 02:08 PM

He's just asking for a hack that sets a forum unaccessible unless you have a certain amount of posts.

I thought this was a standard vB feature.

All you need to do is edit newreply.php and newthread.php and find the following:

PHP Code:

verify_forum_password($foruminfo['forumid'], $foruminfo['password']); 

Then below it place a switch statement checking the users post count:

PHP Code:

switch ($foruminfo['forumid'])
{
    case 
1:  //this means if the forumid is 1
    
if ($bbuserinfo['posts'] < $certain_amount_of_posts)
    {
       
print_no_permission();
    }


Just change the $certain_amount_of_posts to a shorter variable containing the post count.
You can check more forums by just adding more cases to the switch.

deaconxgp 01-26-2004 04:42 PM

thanks V!! that's exactly what I'm talking about dude!! THANKS...but i don't know much about variables so what variable do i put in there to replace $certain_amount_of_posts? do i just add a # there?

Velocd 01-26-2004 08:58 PM

Yes. Here is an example, with 3 forums:

Code:

switch ($foruminfo['forumid'])
{
    case 43:  // this is the forum id
    if ($bbuserinfo['posts'] < 50)  // if the users post count is less than 50 posts
    {
      print_no_permission(); // print a no permissions error
    }

    break;  // this is needed for all cases in a switch except the last

    case 23:  // this is the forum id
    if ($bbuserinfo['posts'] < 70)  // if the users post count is less than 70 posts
    {
      print_no_permission(); // print a no permissions error
    }

    break;

    case 5:  // this is the forum id
    if ($bbuserinfo['posts'] < 150)  // if the users post count is less than 150 posts
    {
      print_no_permission(); // print a no permissions error
    }
}


deaconxgp 01-27-2004 12:41 PM

marvelous!!! i'm gonna test that out right now.

deaconxgp 01-27-2004 12:44 PM

one last thing...can i edit what the no permission page says through the templates in the admin cp somehow?

deaconxgp 01-27-2004 12:50 PM

Code:

PLEASE DO NOT ATTACH/PASTE WHOLE vB FILES
I couldn't find the line you said look for ....this is my newthread.php where would I place the switch?

Velocd 01-27-2004 12:56 PM

I thought there might have been a variable you could place before the standarderror() function that would change the message, much like $url for standardredirect().

You can do this instead though:
Code:

eval('print_output("' . fetch_template('template_name') . '");');
And call another custom template to handle the error.

Velocd 01-27-2004 12:58 PM

Quote:

I couldn't find the line you said look for ....this is my newthread.php where would I place the switch?
You must not be on vBulletin 3 RC2.

Put it below this line instead:
Code:

$foruminfo=getforuminfo($forumid);

Velocd 01-27-2004 01:01 PM

Oh, also please remove that chunk of code you just posted of newthread.php (which is all of it), as that is against vBulletin.org rules.

deaconxgp 01-27-2004 04:09 PM

Thanks V!!! (sorry about the big chunk of code..won't happen again)

I'll try this out and see how it goes.

deaconxgp 01-27-2004 04:12 PM

also, am i replacing the print error line of code with the eval line you just listed?

deaconxgp 01-27-2004 04:46 PM

nevermind ^^ V. I got it to work with New Threads. (which i REALLY appreciate dude!!!!)

I couldn't however find the particular line to replace in the newreply.php. I couldn't find the [forumid] line of code to insert the switch under.


All times are GMT. The time now is 09:58 AM.

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.01213 seconds
  • Memory Usage 1,748KB
  • 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
  • (4)bbcode_code_printable
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (16)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