PDA

View Full Version : Hack to block posting unless you have x # of posts?


deaconxgp
01-24-2004, 02:42 AM
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:


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


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


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:


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
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:
eval('print_output("' . fetch_template('template_name') . '");');

And call another custom template to handle the error.

Velocd
01-27-2004, 12:58 PM
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:
$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.