Skip to content

Commit 420c135

Browse files
committed
fix role audience filter
1 parent ece54f2 commit 420c135

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

classes/audience.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ public static function meets_roles_requirements($notificationid, $userid, $block
148148
JOIN {context} ctx
149149
ON ctx.id = ra.contextid
150150
WHERE ' . $DB->sql_like('ctx.path', ':ctxpath', false) . '
151-
AND roleid ' . $rolessql;
151+
AND roleid ' . $rolessql . '
152+
AND userid = :userid';
152153
$params['ctxpath'] = $context->path . '%';
154+
$params['userid'] = $userid;
153155

154156
return $DB->record_exists_sql($sql, $params);
155157
}

pages/notifications.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@
6868
if (empty($blockinstance) || !isset($blockinstance) || $blockinstance === -1) {
6969
throw new moodle_exception('advnotifications_err_nocapability', 'block_advnotifications');
7070
}
71-
$bcontext = context_block::instance($blockinstance);
7271
$ownnotifs = has_capability('block/advnotifications:manageownnotifications', $bcontext);
7372
}
7473

0 commit comments

Comments
 (0)