Merge branch 'MDL-64439-master' of https://github.com/ilya-catalyst/moodle
[moodle.git] / 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;
                 }
             }