Moodle Word Censorship

It was brought to my attention that when Moodle filters out a word found in the “bad words” list it in fact leaves the word in the alt text.  So moving your mouse over the word “Scunthorpe” produces some quite interesting results!!

The resolve this I edited the file filter/censor/filter.php

And around line 36 replace this code

$words[ ] = new filterobject($badword, ‘<span class=”censoredtext” title=”.$badword.”>’, ‘</span>’,

with this:

$words[ ] = new filterobject($badword, ‘<span class=”censoredtext” title=”Censored”>’, ‘</span>’,

The ALT text now reads the word “censored” rather than displaying the offending word you tried to remove in the first place.


Comments are closed.