Merge branch 'MDL-64439-master' of https://github.com/ilya-catalyst/moodle
authorJake Dallimore <jake@moodle.com>
Thu, 2 May 2019 06:47:39 +0000 (14:47 +0800)
committerJake Dallimore <jake@moodle.com>
Thu, 2 May 2019 06:47:39 +0000 (14:47 +0800)
lib/moodlelib.php

index f881133..67e3e72 100644 (file)
@@ -2699,6 +2699,10 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
                 $authplugin = get_auth_plugin($authname);
                 $authplugin->pre_loginpage_hook();
                 if (isloggedin()) {
+                    if ($cm) {
+                        $modinfo = get_fast_modinfo($course);
+                        $cm = $modinfo->get_cm($cm->id);
+                    }
                     break;
                 }
             }