From 1068fced83a6bee93a8cdfb0432032e1312529ab Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Thu, 13 Jan 2022 11:35:55 -0500 Subject: [PATCH] Plugin: LTI: Set replacement_user_id only when param is set - refs BT#18816 See de09dae298ae7056ff0c8c23ceb2e289c0349872 --- plugin/ims_lti/configure.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/plugin/ims_lti/configure.php b/plugin/ims_lti/configure.php index 098d9b9807..157d01916f 100644 --- a/plugin/ims_lti/configure.php +++ b/plugin/ims_lti/configure.php @@ -59,9 +59,6 @@ switch ($action) { ) ->setCustomParams( empty($formValues['custom_params']) ? null : $formValues['custom_params'] - ) - ->setReplacementForUserId( - empty($formValues['replacement_user_id']) ? [] : $formValues['replacement_user_id'] ) ->setDocumenTarget($formValues['document_target']) ->setCourse($course) @@ -71,6 +68,10 @@ switch ($action) { !empty($formValues['share_picture']) ); + if (!empty($formValues['replacement_user_id'])) { + $tool->setReplacementForUserId($formValues['replacement_user_id']); + } + if (!$baseTool) { if (ImsLti::V_1P3 === $formValues['version']) { $tool @@ -192,10 +193,7 @@ switch ($action) { ) ->setCustomParams( empty($formValues['custom_params']) ? null : $formValues['custom_params'] - ) - ->setReplacementForUserId( - empty($formValues['replacement_user_id']) ? [] : $formValues['replacement_user_id'] - ) + ) ->setDocumenTarget($formValues['document_target']) ->setPrivacy( !empty($formValues['share_name']), @@ -203,6 +201,10 @@ switch ($action) { !empty($formValues['share_picture']) ); + if (!empty($formValues['replacement_user_id'])) { + $tool->setReplacementForUserId($formValues['replacement_user_id']); + } + if (null === $tool->getParent()) { if ($tool->getVersion() === ImsLti::V_1P3) { $tool