From 99a4c4578b07006f080784963ee6862460153c03 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Thu, 25 Aug 2016 17:58:51 +0800 Subject: [PATCH] Fixed context error when using inplace editable on system template --- lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib.php b/lib.php index e430d9a..2c51035 100644 --- a/lib.php +++ b/lib.php @@ -364,7 +364,7 @@ function customcert_extend_settings_navigation(settings_navigation $settings, na * @return \core\output\inplace_editable */ function mod_customcert_inplace_editable($itemtype, $itemid, $newvalue) { - global $DB; + global $DB, $PAGE; if ($itemtype === 'elementname') { $element = $DB->get_record('customcert_elements', array('id' => $itemid), '*', MUST_EXIST); @@ -377,6 +377,7 @@ function mod_customcert_inplace_editable($itemtype, $itemid, $newvalue) { if ($cm = $template->get_cm()) { require_login($cm->course, false, $cm); } else { + $PAGE->set_context(context_system::instance()); require_login(); } // Make sure the user has the required capabilities.