Skip to content

Commit

Permalink
MDL-55754 core_message: fixed unread message count
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed Oct 7, 2016
1 parent 4d1b76e commit d7d7ca2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions message/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d7d7ca2

Please sign in to comment.