Don't render announcements if dismissed

This commit is contained in:
Robbie Antenesse 2019-07-14 15:33:21 -06:00
parent 26e4475fc2
commit 6ee83c7773
1 changed files with 4 additions and 0 deletions

View File

@ -80,6 +80,10 @@ switch ($view) {
$announcements = json_decode($announcements, true);
$announcements_html = '';
foreach ($announcements as $announcement) {
if (isset($announcement['dismissId']) && isset($_COOKIE['announcement-' . $announcement['dismissId']])) {
continue;
}
$expire = strtotime($announcement['expire']);
if (time() < $expire) {
$announcements_html .= '<article class="announcement"' . (isset($announcement['dismissId']) ? ' id="announcement-' . $announcement['dismissId'] . '"' : '') . ' data-expires="' . $announcement['expire'] . '">