MDL-38142 mod_forum: Allow viewing of student posts in hidden courses

This commit is contained in:
Frederic Massart
2015-01-09 11:38:12 +08:00
parent 440085ecf8
commit fec61db075
+1 -1
View File
@@ -7416,7 +7416,7 @@ function forum_get_posts_by_user($user, array $courses, $musthaveaccess = false,
// 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)) {
if (!can_access_course($course, $user) && !is_enrolled($coursecontext, $user)) {
if ($musthaveaccess) {
print_error('notenrolled', 'forum');
}