MDL-64439 auth: Refresh $cm in require_login after pre_loginpage_hook.
authorIlya Tregubov <ilyatregubov@catalyst-au.net>
Wed, 19 Dec 2018 02:21:04 +0000 (13:21 +1100)
committerIlya Tregubov <ilyatregubov@catalyst-au.net>
Mon, 1 Apr 2019 23:20:20 +0000 (10:20 +1100)
lib/moodlelib.php

index fc88a13..cb89621 100644 (file)
@@ -2692,6 +2692,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;
                 }
             }