MDL-56525 forum: remove targeted user enrolment check

By removing the check on the targeted user's enrolment we allow to show his forum posts even if he is unenrol from a course (obviouly we need to have access to this course to view them)
This commit is contained in:
Arnaud Trouve 2016-11-04 18:41:00 +01:00
parent 5ef81f2b0b
commit feda7b3692

View file

@ -7493,15 +7493,6 @@ function forum_get_posts_by_user($user, array $courses, $musthaveaccess = false,
continue;
}
// Check whether the requested user is enrolled or has access to view the course
// if they don't we immediately have a problem.
if (!can_access_course($course, $user) && !is_enrolled($coursecontext, $user)) {
if ($musthaveaccess) {
print_error('notenrolled', 'forum');
}
continue;
}
// If groups are in use and enforced throughout the course then make sure
// we can meet in at least one course level group.
// Note that we check if either the current user or the requested user have