diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2012-09-14 15:59:13 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2012-09-14 15:59:13 -0500 |
commit | fb0ed78c8fffe95d40e47c8dd27d44973eba88ae (patch) | |
tree | 663a972c5eb324d14855a4a51579d6aaf154c0ab /phpBB/includes/functions.php | |
parent | 44aa773ce07d81d4585f3a24a728f9b445c4c098 (diff) | |
download | forums-fb0ed78c8fffe95d40e47c8dd27d44973eba88ae.tar forums-fb0ed78c8fffe95d40e47c8dd27d44973eba88ae.tar.gz forums-fb0ed78c8fffe95d40e47c8dd27d44973eba88ae.tar.bz2 forums-fb0ed78c8fffe95d40e47c8dd27d44973eba88ae.tar.xz forums-fb0ed78c8fffe95d40e47c8dd27d44973eba88ae.zip |
[ticket/11103] Store the item's parent id for marking things read
Mark topics/posts read from the markread() function.
Identify unread items by a grey background in the header (for now)
PHPBB3-11103
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e5c7839894..3d3dd1f5bc 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1285,15 +1285,20 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0) { global $db, $user, $config; - global $request; + global $request, $phpbb_container; if ($mode == 'all') { if ($forum_id === false || !sizeof($forum_id)) { + // Mark all forums read (index page) + + // Mark all topic notifications read for this user + $notifications = $phpbb_container->get('notifications'); + $notifications->mark_notifications_read('topic', false, $user->data['user_id'], $post_time); + if ($config['load_db_lastread'] && $user->data['is_registered']) { - // Mark all forums read (index page) $db->sql_query('DELETE FROM ' . TOPICS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']}"); $db->sql_query('DELETE FROM ' . FORUMS_TRACK_TABLE . " WHERE user_id = {$user->data['user_id']}"); $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_lastmark = ' . time() . " WHERE user_id = {$user->data['user_id']}"); @@ -1330,6 +1335,10 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $forum_id = array($forum_id); } + // Mark topic notifications read for this user in this forum + $notifications = $phpbb_container->get('notifications'); + $notifications->mark_notifications_read_by_parent('topic', $forum_id, $user->data['user_id'], $post_time); + // Add 0 to forums array to mark global announcements correctly // $forum_id[] = 0; @@ -1424,6 +1433,11 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ return; } + // Mark post notifications read for this user in this topic + $notifications = $phpbb_container->get('notifications'); + $notifications->mark_notifications_read_by_parent('post', $topic_id, $user->data['user_id'], $post_time); + $notifications->mark_notifications_read_by_parent('quote', $topic_id, $user->data['user_id'], $post_time); + if ($config['load_db_lastread'] && $user->data['is_registered']) { $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . ' |