From a910f710fcff8c8e28c8eb6c69a76d97ca55e231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Wed, 4 Jan 2017 10:58:44 +0100 Subject: [PATCH] MDL-56225 mod_forum: Fix inability to edit attachments The 'attachments' is not a real DB field here. It comes from the form's filepicker and holds the id of the attachments filearea. The function forum_add_attachment() expects it as a property of the first argument. There were two possible approaches here. Either to pass the raw $newpost to forum_add_attachment(), or add the attachments into the list modifiable fields. The second approach is safer. --- mod/forum/lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/mod/forum/lib.php b/mod/forum/lib.php index f368382374f..2cf35dd3244 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -4401,6 +4401,7 @@ function forum_update_post($newpost, $mform, $unused = null) { 'timestart', 'timeend', 'pinned', + 'attachments', ]; foreach ($modifiablefields as $field) { if (isset($newpost->{$field})) {