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:
+9
-8
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user