I changed the Code a little bit.
The Thread titles now are only displayed to users who can view the forum the last post is in.
PHP Code:
//start get last thread title from forums
$lastposttitle = $DB_site->query("SELECT title FROM thread WHERE forumid='$forum[forumid]' ORDER BY lastpost DESC");
$lastposttitle = $DB_site->fetch_array($lastposttitle);
$lastposttitle = $lastposttitle[title];
$has_access=getpermissions($forum[forumid]);
if (!$has_access['canview']) {
$lastposttitle='';
}
else
{
if (strlen($lastposttitle) > 20) {
$lastposttitle = substr($lastposttitle,0,18);
$lastposttitle .= "..";
}
}
//end get last thread title from forums