diff --git a/controller/controller.php b/controller/controller.php index 4748276..03f6d41 100644 --- a/controller/controller.php +++ b/controller/controller.php @@ -96,8 +96,8 @@ protected function set_board_announcement_cookie() // Get board announcement data from the DB text object $announcement_timestamp = $this->config_text->get('announcement_timestamp'); - // Set a 1 year long cookie - $this->user->set_cookie('ba_' . $announcement_timestamp, '1', time() + 31536000); + // Store the announcement timestamp/id in a cookie with a 1 year expiration + $this->user->set_cookie('baid', $announcement_timestamp, time() + 31536000); return true; } diff --git a/event/listener.php b/event/listener.php index 1662b39..26cef8b 100644 --- a/event/listener.php +++ b/event/listener.php @@ -108,10 +108,10 @@ public function display_board_announcements($event) )); // Get announcement cookie if one exists - $cookie = $this->request->variable($this->config['cookie_name'] . '_ba_' . $board_announcement_data['announcement_timestamp'], '', true, \phpbb\request\request_interface::COOKIE); + $cookie = $this->request->variable($this->config['cookie_name'] . '_baid', '', true, \phpbb\request\request_interface::COOKIE); // Do not continue if announcement has been disabled or dismissed - if (!$this->config['board_announcements_enable'] || !$this->user->data['board_announcements_status'] || $cookie) + if (!$this->config['board_announcements_enable'] || !$this->user->data['board_announcements_status'] || $cookie == $board_announcement_data['announcement_timestamp']) { return; }