Merge branch 'wip-MDL-59411-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE

This commit is contained in:
David Monllao
2017-07-17 15:48:22 +02:00
2 changed files with 33 additions and 8 deletions
+5 -7
View File
@@ -2898,13 +2898,11 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
if ($preventredirect) {
throw new require_login_exception('Activity is hidden');
}
if ($course->id != SITEID) {
$url = new moodle_url('/course/view.php', array('id' => $course->id));
} else {
$url = new moodle_url('/');
}
redirect($url, get_string('activityiscurrentlyhidden'), null,
\core\output\notification::NOTIFY_ERROR);
// Get the error message that activity is not available and why (if explanation can be shown to the user).
$PAGE->set_course($course);
$renderer = $PAGE->get_renderer('course');
$message = $renderer->course_section_cm_unavilable_error_message($cm);
redirect(course_get_url($course), $message, null, \core\output\notification::NOTIFY_ERROR);
}
// Set the global $COURSE.