From feda7b3692101b4e9e72644a653edefca276f3a4 Mon Sep 17 00:00:00 2001 From: Arnaud Trouve Date: Fri, 4 Nov 2016 18:41:00 +0100 Subject: [PATCH] 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) --- mod/forum/lib.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 5b3b1a3e491f0..75079441c32e4 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -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