Journal feedback stripslash inserts causing problems

As many of you may know, journal feedback in Moodle is via a text box and not a WYSIWYG editor. So when a tutor leaves feedback containing an apostrophe, a stripslash (backslash) is inserted into the text. This is fine and I understand the (MySQL) reasons why, however… my tutors do not! Each time a tutor saves new feedback, an extra stripslash is added. After many edits the feedback is littered with stripslashes.

So as a temporary fix I have removed the stripslashes by modifying /mod/journal/report.php.

By replacing the line:

$entrybyuser[$entry->userid]->entrycomment = $vals[‘c’];

with

$entrybyuser[$entry->userid]->entrycomment = stripslashes($vals[‘c’]);

I realise that this may create a rod for my back further down the line, especially when it comes to exporting or importing this table from MySQL but it will certainly save me lots of earache in the upcoming months, especially as the journals will be assessed and OFSTED will not be too happy wading through pages of stripslashes.

Next post The Moodle Dashboard