Okay I've seen a lot of demand for this so decided to give it a shot. It is still in BETA so please don't use it without taking full backups etc! I will release a final version in a week or so.
It was developed on v2 beta 3 but I would imagine it would work on any v2 beta.
1. Add a field to the forum table called "password". Make it CHAR of 50 characters. You can also run this SQL statement:
Code:
ALTER TABLE forum ADD password CHAR (50) not null
forumdisplay.php
Put this on line 33:
PHP Code:
if ($action == "dopassword") {
if (md5($password) == md5($foruminfo['password'])) {
vbsetcookie("bbforumpass[$forumid]", md5($foruminfo['password']),0);
} else {
eval("standarderror(\"".gettemplate('error_passwordrequired')."\");");
exit;
}
} else {
if ($foruminfo['password']) {
if ($bbforumpass[$forumid] != md5($foruminfo['password'])) {
eval("standarderror(\"".gettemplate('error_passwordrequired')."\");");
exit;
}
}
}
showthread.php
Insert on line 114:
PHP Code:
if ($forum['password']) {
if ($bbforumpass[$forumid] != md5($foruminfo['password'])) {
eval("standarderror(\"".gettemplate('error_passwordrequired')."\");");
exit;
}
}
admin/forum.php
Line 94:
PHP Code:
makeinputcode("Forum Password<br>(Max length of 50 characters)","password");
Templates
Add a template called error_passwordrequired. In it should be this:
Quote:
A password is required to enter this forum. Please enter it below: <br>
<form action="forumdisplay.php" method="POST">
<input type="password" name="password">
<br>
<input type="hidden" name="action" value="dopassword">
<input type="hidden" name="forumid" value=$foruminfo[forumid]>
<input type="submit" value="Submit">
</form>