Affects Version/s: 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.6, 1.6.1, 1.6.2, 1.6.3
Affected Branches:MOODLE_15_STABLE, MOODLE_16_STABLE
Fixed Branches:MOODLE_16_STABLE, MOODLE_17_STABLE
When searching a forum, if there are any matches in a post whose format is FORMAT_PLAIN, highlighting of terms does not work.
The problem is caused by the forum highlighting function (mod/forum/search.php), as it is not testing wether the post to highlight is in html format. If it is not, it will add some HTML tags which will be latter stripped by forum_print_post (mod/forum/lib.php) by the format_text (lib/weblib.php) function.
Here is a patch for the issue:
+++ search.php 20 Sep 2006 12:27:16 -0000
@@ -204,6 +204,15 @@
//Use highlight() with nonsense tags to spot search terms in the
//actual text content first. fiedorow - 9/2/2005
$missing_terms = "";
+ if ($post->format == FORMAT_PLAIN)
$message = highlight($strippedsearch,format_text($post->message, $post->format, NULL, $course->id),