MDL-43621 badges: Fix has_awards() result when deleted users are the only recipients of a badge
This commit is contained in:
+5
-4
@@ -331,10 +331,11 @@ class badge {
|
||||
*/
|
||||
public function has_awards() {
|
||||
global $DB;
|
||||
if ($DB->record_exists('badge_issued', array('badgeid' => $this->id))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
$awarded = $DB->record_exists_sql('SELECT b.uniquehash
|
||||
FROM {badge_issued} b INNER JOIN {user} u ON b.userid = u.id
|
||||
WHERE b.badgeid = :badgeid AND u.deleted = 0', array('badgeid' => $this->id));
|
||||
|
||||
return $awarded;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user