MDL-53210 mod_feedback: fixes in check feedback access

1. show only uservisible feedbacks in block_feedback
2. nicer error message when user opens feedback on frontpage instead of from the mapped course
3. corrected cap check in view.php page before displaying link to complete.php
This commit is contained in:
Marina Glancy 2016-02-23 16:03:07 +08:00
parent 6ab07f97bf
commit 2a94a2f60f
3 changed files with 36 additions and 24 deletions

View file

@ -2815,7 +2815,11 @@ function feedback_get_feedbacks_from_sitecourse_map($courseid) {
}
}
return array_merge($feedbacks1, $feedbacks2);
$feedbacks = array_merge($feedbacks1, $feedbacks2);
$modinfo = get_fast_modinfo(SITEID);
return array_filter($feedbacks, function($f) use ($modinfo) {
return ($cm = $modinfo->get_cm($f->cmid)) && $cm->uservisible;
});
}