Merge branch 'MDL-38142-master' of git://github.com/FMCorz/moodle

This commit is contained in:
Andrew Nicols 2015-01-12 11:55:34 +08:00
commit 99334f6a56

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');
}