Fixed context error when using inplace editable on system template
This commit is contained in:
parent
56c1af1b84
commit
99a4c4578b
1 changed files with 2 additions and 1 deletions
3
lib.php
3
lib.php
|
@ -364,7 +364,7 @@ function customcert_extend_settings_navigation(settings_navigation $settings, na
|
||||||
* @return \core\output\inplace_editable
|
* @return \core\output\inplace_editable
|
||||||
*/
|
*/
|
||||||
function mod_customcert_inplace_editable($itemtype, $itemid, $newvalue) {
|
function mod_customcert_inplace_editable($itemtype, $itemid, $newvalue) {
|
||||||
global $DB;
|
global $DB, $PAGE;
|
||||||
|
|
||||||
if ($itemtype === 'elementname') {
|
if ($itemtype === 'elementname') {
|
||||||
$element = $DB->get_record('customcert_elements', array('id' => $itemid), '*', MUST_EXIST);
|
$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()) {
|
if ($cm = $template->get_cm()) {
|
||||||
require_login($cm->course, false, $cm);
|
require_login($cm->course, false, $cm);
|
||||||
} else {
|
} else {
|
||||||
|
$PAGE->set_context(context_system::instance());
|
||||||
require_login();
|
require_login();
|
||||||
}
|
}
|
||||||
// Make sure the user has the required capabilities.
|
// Make sure the user has the required capabilities.
|
||||||
|
|
Loading…
Reference in a new issue