Skip to content

Commit

Permalink
Merge branch 'MDL-45762-master' of https://github.com/xow/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols authored and danpoltawski committed Jun 16, 2016
2 parents a029e52 + 8e61e0f commit d91b685
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions course/view.php
Expand Up @@ -104,10 +104,18 @@

// Check user is allowed to see it.
if (!$coursesections->uservisible) {
// Note: We actually already know they don't have this capability
// or uservisible would have been true; this is just to get the
// correct error message shown.
require_capability('moodle/course:viewhiddensections', $context);
// Check if coursesection has conditions affecting availability and if
// so, output availability info.
if ($coursesections->visible && $coursesections->availableinfo) {
$sectionname = get_section_name($course, $coursesections);
$message = get_string('notavailablecourse', '', $sectionname);
redirect(course_get_url($course), $message, null, \core\output\notification::NOTIFY_ERROR);
} else {
// Note: We actually already know they don't have this capability
// or uservisible would have been true; this is just to get the
// correct error message shown.
require_capability('moodle/course:viewhiddensections', $context);
}
}
}

Expand Down

0 comments on commit d91b685

Please sign in to comment.