Here is the code for this hack that had worked for me very well:
Open newreply.php and look for:
Code:
// redirect
if ($visible==1) {
$goto="showthread.php?postid=$postid#post$postid";
} else {
$goto="forumdisplay.php?forumid=$forumid";
}
and add just below:
Code:
if ($close) {
//check valid username and password and get user id
$userid=verifyusername($username,$password);
$getthread=$DB_site->query_first("SELECT forumid FROM thread WHERE threadid=$threadid");
$forumid=$getthread[forumid];
$foruminfo=$DB_site->query_first("SELECT active,allowposting FROM forum WHERE forumid=$forumid");
if ($foruminfo[active]==0) {
echo standarderror($bbtitle,gettemplate("error_forumclosed",0));
exit;
}
$threadinfo=$DB_site->query_first("SELECT open FROM thread WHERE threadid=$threadid");
$permissions=getpermissions($bbuserid,$bbusergroupid,$forumid);
if ($permissions[canview]==0 or ($permissions[canopenclose]==0 and $permissions[canadminedit]==0)) {
$firstpostinfo=$DB_site->query_first("SELECT userid FROM post WHERE threadid=$threadid ORDER BY dateline LIMIT 1");
eval("echo standarderror(\$bbtitle,\"".gettemplate("error_nopermission")."\");");
exit;
} elseif ($permissions[canadminedit]==0) {
$firstpostinfo=$DB_site->query_first("SELECT userid FROM post WHERE threadid=$threadid ORDER BY dateline LIMIT 1");
if ($bbuserid!=$firstpostinfo[userid]) {
eval("echo standarderror(\$bbtitle,\"".gettemplate("error_nopermission")."\");");
exit;
}
}
$DB_site->query("UPDATE thread SET open=0 WHERE threadid=$threadid");
$action="closing";
eval("echo standardredirect(\$bbtitle,\"".gettemplate("redirect_openclose")."\",\"showthread.php?threadid=$threadid\");");
exit;
}
Save and upload the modified file.
Now open the template "newreply" and under:
Code:
<BR><INPUT TYPE="CHECKBOX" NAME="signature" VALUE="yes" $signaturechecked> <B>Show Signature:</B> include your profile signature. Only registered users may have signatures.
add this:
Code:
<BR><INPUT TYPE="CHECKBOX" NAME="close" VALUE="yes"> <B>Close Thread after posting</B>
I hope that will help anyone