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.
This commit is contained in:
David Mudrák 2017-01-04 10:58:44 +01:00 committed by Dan Poltawski
parent 9afc02742b
commit 1af801be98

View File

@ -4428,6 +4428,7 @@ function forum_update_post($newpost, $mform, $unused = null) {
'timestart',
'timeend',
'pinned',
'attachments',
];
foreach ($modifiablefields as $field) {
if (isset($newpost->{$field})) {