Put this before
PHP Code:
foreach(array_keys($forumcache) AS $forumid)
{
$forumperms = fetch_permissions($forumid);
if ($forumperms & CANVIEW AND $forumperms & CANVIEWOTHERS)
{
$allow_forumids[] = $forumid;
}
}
$allowids = implode(",", $allow_forumids);
unset ($forumperms);
Then you can use this request :
PHP Code:
$newposts = $DB_site->query_first("SELECT count(*) AS count FROM " . TABLE_PREFIX . "post as p
LEFT JOIN " . TABLE_PREFIX . "thread as t ON (t.threadid = p.threadid)
WHERE p.dateline > '" . $bbuserinfo[lastvisit]. "' AND t.forumid IN($allowids)");