In the end I went with this:
Code:
foreach ($vbulletin->forumcache as &$forum)
{
$forumperms =& $vbulletin->userinfo['forumpermissions'][$forum['forumid']];
if (forum_accessible($forum, $forumperms))
{
$forumids[] = $forum['forumid'];
}
}
function forum_accessible($forum, $forumperms)
{
global $vbulletin;
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']))
return false;
if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['active']))
return false;
if (!verify_forum_password($forum['forumid'], $forum['password'], false))
return false;
if (trim($forum['link']))
return false;
if ($forum['displayorder'] == 0)
return false;
return true;
}