diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 11d5b871a89..633be19178b 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -3529,7 +3529,7 @@ function forum_print_post($post, $discussion, $forum, &$cm, $course, $ownpost=fa $postcontent = highlight($highlight, $postcontent); } if (!empty($forum->displaywordcount)) { - $postcontent .= html_writer::tag('div', get_string('numwords', 'moodle', count_words($post->message)), + $postcontent .= html_writer::tag('div', get_string('numwords', 'moodle', count_words($postcontent)), array('class'=>'post-word-count')); } $postcontent .= html_writer::tag('div', $attachedimages, array('class'=>'attachedimages')); diff --git a/mod/forum/post.php b/mod/forum/post.php index 4f79679b41b..5683a233fb9 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -683,6 +683,9 @@ if ($mform_post->is_cancelled()) { // WARNING: the $fromform->message array has been overwritten, do not use it anymore! $fromform->messagetrust = trusttext_trusted($modcontext); + // Clean message text. + $fromform = trusttext_pre_edit($fromform, 'message', $modcontext); + if ($fromform->edit) { // Updating a post unset($fromform->groupid); $fromform->id = $fromform->edit;