mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
MDL-25981 make sure cm is defined
This commit is contained in:
parent
0d8b6a69ce
commit
d4fb0e26e2
@ -2654,7 +2654,7 @@ function require_course_login($courseorid, $autologinguest = true, $cm = NULL, $
|
||||
global $CFG, $PAGE, $SITE;
|
||||
$issite = (is_object($courseorid) and $courseorid->id == SITEID)
|
||||
or (!is_object($courseorid) and $courseorid == SITEID);
|
||||
if ($issite && !($cm instanceof cm_info)) {
|
||||
if ($issite && !empty($cm) && !($cm instanceof cm_info)) {
|
||||
// note: nearly all pages call get_fast_modinfo anyway and it does not make any
|
||||
// db queries so this is not really a performance concern, however it is obviously
|
||||
// better if you use get_fast_modinfo to get the cm before calling this.
|
||||
|
Loading…
x
Reference in New Issue
Block a user