In your ubbttopthreads.php addon find this:
code:
// -----------------------------
// End of the variables section
require("$path/main.inc.php");
and change it to this:
code:
// -----------------------------
// End of the variables section
require_once("$path/main.inc.php");
$userob = new user;
$user = $userob -> authenticate("U_Groups");
if ($user['U_Username']) {
$Grouparray = split("-",$user['U_Groups']);
$gsize = sizeof($Grouparray);
$groupquery = "AND (";
$g = 0;
for ($i=0; $i<$gsize;$i++) {
if (!preg_match("/[0-9]/",$Grouparray[$i])) { continue; };
$g++;
if ($g > 1) {
$groupquery .= " OR ";
}
$groupquery .= "Bo_Read_Perm LIKE '%-$Grouparray[$i]-%'";
}
$groupquery .= ")";
}
else {
$groupquery = "AND Bo_Read_Perm LIKE '%-4-%'";
}
Then find this:
code:
$query = "
SELECT B_Number,B_Posted,B_Last_Post,B_Username,B_Subject,B_Body,B_Main,B_Replies,B_Counter,B_Board
FROM {$config['tbprefix']}Posts
WHERE B_Number = B_Main
AND B_Last_Post > '$date'
ORDER BY $sort DESC
LIMIT $totalthreads
";
and change it to this:
code:
$query = "
SELECT B_Number,B_Posted,B_Last_Post,B_Username,B_Subject,B_Body,B_Main,B_Replies,B_Counter,B_Board
FROM {$config['tbprefix']}Posts
WHERE B_Number = B_Main
AND B_Last_Post > '$date'
$groupquery
ORDER BY $sort DESC
LIMIT $totalthreads
";
Make sure your cookies are set site wide so that this script can authenticate the viewer if this is placed outside the .threads directory.

I haven't tested this but it should work.
