Bug fixed, and released as v1.5
To upgrade, simply redo a global.php edit.
Here's the new code:
PHP Code:
// #############################################################################
// get new announcement popup
$newannounce = 0;
$shownewannounce = false;
if ($bbuserinfo['userid'] AND $bbuserinfo['announcepopup'] == 2)
{
$DB_site->shutdown_query("UPDATE " . TABLE_PREFIX . "user SET announcepopup = 1 WHERE userid = $bbuserinfo[userid]", 'announcepopup');
if (THIS_SCRIPT != 'announcement')
{
$newannounce = 1;
$newann = $DB_site->query_first("
SELECT * FROM " . TABLE_PREFIX . "announcement AS announcement
WHERE forumid = '-1'
ORDER BY startdate DESC
LIMIT 1
");
$annforum = iif($newann['forumid'] == -1, true, false);
if ($annforum == true)
{
$forumpermarray = $bbuserinfo['forumpermissions'];
ksort($forumpermarray);
reset($forumpermarray);
foreach ($forumpermarray as $key => $value)
{
$forumperm["$key"] = convert_bits_to_array($forumpermarray["$key"], $_BITFIELD['usergroup']['forumpermissions']);
if ($forumperm["$key"]['canview'] == 1)
{
$forumids .= ", $key";
}
}
$forumids = substr_replace($forumids, '', 0, 2);
$forumann = $DB_site->query_first("
SELECT
forumid
FROM
" . TABLE_PREFIX . "forum
WHERE forumid IN ($forumids)
ORDER BY RAND()");
$theforum = $forumann['forumid'];
}
else
{
$theforum = $newann['forumid'];
}
$newann['title'] = addslashes(unhtmlspecialchars($newann['title'], true));
$shownewannounce = true;
}
}