]> git.mjollnir.org Git - moodle.git/commitdiff
pagelib: MDL-12212 require_login should set $PAGE->cm, if appicable.
authortjhunt <tjhunt>
Tue, 21 Jul 2009 07:02:06 +0000 (07:02 +0000)
committertjhunt <tjhunt>
Tue, 21 Jul 2009 07:02:06 +0000 (07:02 +0000)
lib/moodlelib.php

index 2578f619630a8a28ddaf7d8cef62d7c3c24ce13e..f9316936ebcaa7e9ddc56fc099258d16c0147777 100644 (file)
@@ -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.