Commit 219f956a authored by Cameron Ball's avatar Cameron Ball
Browse files

MDL-49143 LTI: Fix missing resource id

parent fd57d685
......@@ -362,6 +362,12 @@ function lti_build_request($instance, $typeconfig, $course, $typeid = null, $isl
'context_label' => $course->shortname,
'context_title' => $course->fullname,
);
if (!empty($instance->id)) {
$requestparams['resource_link_id'] = $instance->id;
}
if (!empty($instance->resource_link_id)) {
$requestparams['resource_link_id'] = $instance->resource_link_id;
}
if ($course->format == 'site') {
$requestparams['context_type'] = 'Group';
} else {
......@@ -370,7 +376,7 @@ function lti_build_request($instance, $typeconfig, $course, $typeid = null, $isl
}
$placementsecret = $instance->servicesalt;
if ( isset($placementsecret) && ($islti2 ||
if ( !empty($instance->id) && isset($placementsecret) && ($islti2 ||
$typeconfig['acceptgrades'] == LTI_SETTING_ALWAYS ||
($typeconfig['acceptgrades'] == LTI_SETTING_DELEGATE && $instance->instructorchoiceacceptgrades == LTI_SETTING_ALWAYS))) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment