From a48f09033810148fd9b2d5a0b6a683f14ac73a6a Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 14 Oct 2012 12:35:35 -0500 Subject: [ticket/11103] Make sure notifications are marked read when clicking them How do we do this? If an item is unread, the URL to view that item will be the URL to mark it as read (index.php?mark_notification=$id). When the URL is visited it marks the item as read and redirects them to the correct URL for the item. If the item is read, the URL is directly to the item. Prettify the html output PHPBB-11103 --- phpBB/index.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'phpBB/index.php') diff --git a/phpBB/index.php b/phpBB/index.php index af0441f5e3..7f85879d23 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -23,6 +23,23 @@ $user->session_begin(); $auth->acl($user->data); $user->setup(); +// Mark notifications read +if (($mark_notification = request_var('mark_notification', 0))) +{ + $notification = $phpbb_notifications->load_notifications(array( + 'notification_id' => $mark_notification + )); + + if (isset($notification['notifications'][$mark_notification])) + { + $notification = $notification['notifications'][$mark_notification]; + + $notification->mark_read(); + + redirect($notification->get_url()); + } +} + // Handle the display of extension front pages if ($ext = $request->variable('ext', '')) { @@ -56,13 +73,6 @@ if ($ext = $request->variable('ext', '')) exit_handler(); } -// Mark notifications read -$mark_notifications = request_var('mark_notification', array(0)); -if (!empty($mark_notifications)) -{ - $phpbb_notifications->mark_notifications_read_by_id($mark_notifications); -} - include($phpbb_root_path . 'includes/functions_display.' . $phpEx); $user->add_lang('viewforum'); -- cgit v1.2.1