From bfe6cfc9ab614dd32eb5ea82212609f6afb8c68c Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Thu, 17 Oct 2019 13:21:05 +1100 Subject: [PATCH] MDL-66808 mod_forum: set the format col to FORMAT_PLAIN when it is plain --- mod/forum/export.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mod/forum/export.php b/mod/forum/export.php index 636cfc8208d..13450b7de45 100644 --- a/mod/forum/export.php +++ b/mod/forum/export.php @@ -90,11 +90,8 @@ if ($form->is_cancelled()) { $striphtml = !empty($data->striphtml); $humandates = !empty($data->humandates); - $fields = ['id', 'discussion', 'parent', 'userid', 'created', 'modified', 'mailed', 'subject', 'message']; - if (!$striphtml) { - $fields[] = 'messageformat'; - } - $fields = array_merge($fields, ['messagetrust', 'attachment', 'totalscore', 'mailnow', 'deleted', 'privatereplyto']); + $fields = ['id', 'discussion', 'parent', 'userid', 'created', 'modified', 'mailed', 'subject', 'message', + 'messageformat', 'messagetrust', 'attachment', 'totalscore', 'mailnow', 'deleted', 'privatereplyto']; $datamapper = $legacydatamapperfactory->get_post_data_mapper(); $exportdata = new ArrayObject($datamapper->to_legacy_objects($posts)); @@ -116,7 +113,7 @@ if ($form->is_cancelled()) { // matter what. We use http://example.com/. $data->message = str_replace('@@PLUGINFILE@@/', 'http://example.com/', $data->message); $data->message = html_to_text(format_text($data->message, $data->messageformat), 0, false); - unset($data->messageformat); + $data->messageformat = FORMAT_PLAIN; } if ($humandates) { $data->created = userdate($data->created);