Take a look at newreply.php:
Code:
$permissions=getpermissions($threadinfo[forumid]);
if (($bbuserinfo['userid']!=$threadinfo['postuserid']) and (!$permissions['canviewothers'] or !$permissions['canreplyothers'])) {
show_nopermission();
}
if (!$permissions['canview'] or (!$permissions['canreplyown'] and $bbuserinfo['userid']==$threadinfo['postuserid'])) {
show_nopermission();
}
You will need to replace all $threadinfo['xxx'] vars with the $thread array, because that's how it works in showthread.php.
Need I say more?