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:
<pre>
+++ 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),
0,'<fgw9sdpq4>','</fgw9sdpq4>');
</pre>