diff options
| author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-10-14 12:35:35 -0500 |
|---|---|---|
| committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-10-14 12:35:35 -0500 |
| commit | a48f09033810148fd9b2d5a0b6a683f14ac73a6a (patch) | |
| tree | cd4fa36aaff27b628f1607dec517c3321db1e9f3 /phpBB/includes | |
| parent | 716635c834dd2d6644f3d47c67f7184f95a35c0b (diff) | |
| download | forums-a48f09033810148fd9b2d5a0b6a683f14ac73a6a.tar forums-a48f09033810148fd9b2d5a0b6a683f14ac73a6a.tar.gz forums-a48f09033810148fd9b2d5a0b6a683f14ac73a6a.tar.bz2 forums-a48f09033810148fd9b2d5a0b6a683f14ac73a6a.tar.xz forums-a48f09033810148fd9b2d5a0b6a683f14ac73a6a.zip | |
[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
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/notification/manager.php | 2 | ||||
| -rw-r--r-- | phpBB/includes/notification/type/base.php | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php index fc9b48c624..03776de2b4 100644 --- a/phpBB/includes/notification/manager.php +++ b/phpBB/includes/notification/manager.php @@ -165,7 +165,7 @@ class phpbb_notification_manager } $load_special[$row['item_type']] = array_merge($load_special[$row['item_type']], $notification->get_load_special()); - $notifications[] = $notification; + $notifications[$row['notification_id']] = $notification; } $this->load_users($user_ids); diff --git a/phpBB/includes/notification/type/base.php b/phpBB/includes/notification/type/base.php index e8959d1352..9ef0e71009 100644 --- a/phpBB/includes/notification/type/base.php +++ b/phpBB/includes/notification/type/base.php @@ -138,7 +138,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i 'UNREAD' => $this->unread, - 'U_MARK_READ' => append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification[]=' . $this->notification_id), + 'U_MARK_READ' => append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id), ); } @@ -148,7 +148,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) * @return string */ - public function mark_read($return = true) + public function mark_read($return = false) { return $this->mark(false, $return); } @@ -159,7 +159,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) * @return string */ - public function mark_unread($return = true) + public function mark_unread($return = false) { return $this->mark(true, $return); } @@ -352,11 +352,11 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i $this->unread = (bool) $unread; $where = array( - 'item_type = ' . $this->db->sql_escape($this->item_type), + "item_type = '" . $this->db->sql_escape($this->item_type) . "'", 'item_id = ' . (int) $this->item_id, 'user_id = ' . (int) $this->user_id, ); - $where = implode(' AND ' . $where); + $where = implode(' AND ', $where); if ($return) { @@ -364,7 +364,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i } $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' - SET unread = ' . $this->unread . ' + SET unread = ' . (int) $this->unread . ' WHERE ' . $where; $this->db->sql_query($sql); } |
