MDL-65641 forum: Make forum post form to honor existing MOODLE_FORMAT
Since the night of the times (MDL-16698) we have been performing that simple empty($post->messageformat) check to decide if the preferred editor format should be used, instead of any existing format. Problem is that FORMAT_MOODLE == 0, so the condition evaluates to to true and then the preferred editor takes the baton when it should not. Exiting format must win always! So this just makes the condition a little better, checking if the attribute is set and that it's numerical (accepting both n and 'n'). That covers the FORMAT_MOODLE case and any other valid format. Only if the conditions aren't met the preferred editor format takes the baton. Only then.
This commit is contained in:
+2
-1
@@ -737,7 +737,8 @@ $mformpost->set_data(
|
||||
'subject' => $post->subject,
|
||||
'message' => array(
|
||||
'text' => $currenttext,
|
||||
'format' => empty($post->messageformat) ? editors_get_preferred_format() : $post->messageformat,
|
||||
'format' => !isset($post->messageformat) || !is_numeric($post->messageformat) ?
|
||||
editors_get_preferred_format() : $post->messageformat,
|
||||
'itemid' => $draftideditor
|
||||
),
|
||||
'discussionsubscribe' => $discussionsubscribe,
|
||||
|
||||
Reference in New Issue
Block a user