MDL-49418 core: partial revert of MDL-48804

this is a quick fix for the issue 'Course module with two or more availability restrictions is not accessible'
MDL-49434 is created to deal with the renderer access inside availability check
This commit is contained in:
Marina Glancy
2015-03-09 11:32:19 +08:00
parent 8533cba2ae
commit 44b789cc6d
+9 -8
View File
@@ -3140,6 +3140,15 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
}
}
// Set the global $COURSE.
// TODO MDL-49434: setting current course/cm should be after the check $cm->uservisible .
if ($cm) {
$PAGE->set_cm($cm, $course);
$PAGE->set_pagelayout('incourse');
} else if (!empty($courseorid)) {
$PAGE->set_course($course);
}
// Check visibility of activity to current user; includes visible flag, groupmembersonly, conditional availability, etc.
if ($cm && !$cm->uservisible) {
if ($preventredirect) {
@@ -3153,14 +3162,6 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
redirect($url, get_string('activityiscurrentlyhidden'));
}
// Set the global $COURSE.
if ($cm) {
$PAGE->set_cm($cm, $course);
$PAGE->set_pagelayout('incourse');
} else if (!empty($courseorid)) {
$PAGE->set_course($course);
}
// Finally access granted, update lastaccess times.
user_accesstime_log($course->id);
}