MDL-44725 Availability: Replace groupmembersonly - login (5)
Remove groupmembersonly option from require_login. NOTE: This code, and another branch (both related to login when accessing activities on the site course), are not actually necessary because there is code above which already checks $cm->uservisible. NOTE: You can see this change more simply by doing git diff --ignore-space-change; indent was altered.
This commit is contained in:
+19
-28
@@ -3253,37 +3253,28 @@ function require_course_login($courseorid, $autologinguest = true, $cm = null, $
|
||||
|
||||
} else if ($issite) {
|
||||
// Login for SITE not required.
|
||||
if ($cm and empty($cm->visible)) {
|
||||
// Hidden activities are not accessible without login.
|
||||
require_login($courseorid, $autologinguest, $cm, $setwantsurltome, $preventredirect);
|
||||
} else if ($cm and !empty($CFG->enablegroupmembersonly) and $cm->groupmembersonly) {
|
||||
// Not-logged-in users do not have any group membership.
|
||||
require_login($courseorid, $autologinguest, $cm, $setwantsurltome, $preventredirect);
|
||||
} else {
|
||||
// We still need to instatiate PAGE vars properly so that things that rely on it like navigation function correctly.
|
||||
if (!empty($courseorid)) {
|
||||
if (is_object($courseorid)) {
|
||||
$course = $courseorid;
|
||||
} else {
|
||||
$course = clone($SITE);
|
||||
}
|
||||
if ($cm) {
|
||||
if ($cm->course != $course->id) {
|
||||
throw new coding_exception('course and cm parameters in require_course_login() call do not match!!');
|
||||
}
|
||||
$PAGE->set_cm($cm, $course);
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
} else {
|
||||
$PAGE->set_course($course);
|
||||
}
|
||||
// We still need to instatiate PAGE vars properly so that things that rely on it like navigation function correctly.
|
||||
if (!empty($courseorid)) {
|
||||
if (is_object($courseorid)) {
|
||||
$course = $courseorid;
|
||||
} else {
|
||||
// If $PAGE->course, and hence $PAGE->context, have not already been set up properly, set them up now.
|
||||
$PAGE->set_course($PAGE->course);
|
||||
$course = clone $SITE;
|
||||
}
|
||||
// TODO: verify conditional activities here.
|
||||
user_accesstime_log(SITEID);
|
||||
return;
|
||||
if ($cm) {
|
||||
if ($cm->course != $course->id) {
|
||||
throw new coding_exception('course and cm parameters in require_course_login() call do not match!!');
|
||||
}
|
||||
$PAGE->set_cm($cm, $course);
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
} else {
|
||||
$PAGE->set_course($course);
|
||||
}
|
||||
} else {
|
||||
// If $PAGE->course, and hence $PAGE->context, have not already been set up properly, set them up now.
|
||||
$PAGE->set_course($PAGE->course);
|
||||
}
|
||||
user_accesstime_log(SITEID);
|
||||
return;
|
||||
|
||||
} else {
|
||||
// Course login always required.
|
||||
|
||||
Reference in New Issue
Block a user