From: tjhunt Date: Tue, 21 Jul 2009 07:02:06 +0000 (+0000) Subject: pagelib: MDL-12212 require_login should set $PAGE->cm, if appicable. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=95d28870a28db90f7e436749f1b2497021ab7d09;p=moodle.git pagelib: MDL-12212 require_login should set $PAGE->cm, if appicable. --- diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 2578f61963..f9316936eb 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -1989,7 +1989,11 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null, $setwantsu throw new moodle_exception('invalidcourseid'); } } - $PAGE->set_course($course); + if ($cm) { + $PAGE->set_cm($cm, $course); + } else { + $PAGE->set_course($course); + } } else { // If $PAGE->course, and hence $PAGE->context, have not already been set // up properly, set them up now.