Merge branch 'MDL-31869_message_search_roles' of git://github.com/andyjdavis/moodle
authorAparup Banerjee <aparup@moodle.com>
Tue, 27 Mar 2012 01:58:44 +0000 (09:58 +0800)
committerAparup Banerjee <aparup@moodle.com>
Tue, 27 Mar 2012 01:58:44 +0000 (09:58 +0800)
message/lib.php

index 6fd8a46..7e80811 100644 (file)
@@ -1503,7 +1503,7 @@ function message_search_users($courseid, $searchtext, $sort='', $exceptions='')
 
         // everyone who has a role assignment in this course or higher
         $params = array($USER->id, "%$searchtext%");
-        $users = $DB->get_records_sql("SELECT $ufields, mc.id as contactlistid, mc.blocked
+        $users = $DB->get_records_sql("SELECT DISTINCT $ufields, mc.id as contactlistid, mc.blocked
                                          FROM {user} u
                                          JOIN {role_assignments} ra ON ra.userid = u.id
                                          LEFT JOIN {message_contacts} mc