From d7d7ca2ea149c76e401011a0d2307cc273c854a2 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Mon, 29 Aug 2016 16:02:38 +0800 Subject: [PATCH] MDL-55754 core_message: fixed unread message count --- message/lib.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/message/lib.php b/message/lib.php index c6e4b927910..bc673e3a55c 100644 --- a/message/lib.php +++ b/message/lib.php @@ -412,9 +412,11 @@ function message_get_recent_conversations($user, $limitfrom=0, $limitto=100) { $unread = $DB->get_records_sql($sql, $params, $limitfrom, $limitto); $unreadcountssql = 'SELECT useridfrom, count(*) as count - FROM {message} - WHERE useridto = :userid - GROUP BY useridfrom'; + FROM {message} + WHERE useridto = :userid + AND timeusertodeleted = 0 + AND notification = 0 + GROUP BY useridfrom'; $unreadcounts = $DB->get_records_sql($unreadcountssql, array('userid' => $user->id)); // Union the 2 result sets together looking for the message with the most