From 48dc4c02ae097258f8b4a9c39c38580d29b640f3 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 22 Oct 2014 18:02:43 -0400 Subject: [ticket/13205] Add a mark all messages read link to PM folders PHPBB3-13205 --- phpBB/includes/functions_privmsgs.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'phpBB/includes/functions_privmsgs.php') diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ad142b1cca..79f818caf2 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -914,6 +914,23 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) } } +function mark_folder_read($user_id, $folder_id) +{ + global $db; + + $sql = 'SELECT msg_id FROM ' . PRIVMSGS_TO_TABLE . " + WHERE folder_id = $folder_id + AND user_id = $user_id + AND pm_unread = 1"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + update_unread_status(true, $row['msg_id'], $user_id, $folder_id); + } + $db->sql_freeresult($result); +} + /** * Handle all actions possible with marked messages */ -- cgit v1.2.1