An alternative behaviour would be to validate the form submission and prevent completion if filtered words are encountered. This will give people a chance to fix their text. Not sure if this is possible with hook_filter.
With this behaviour the module is not acting as a filter anymore, but the end result is pretty close IMO.
Comments
Comment #1
jaydub commentedYou can implement this yourself by writing a custom form validation handler and running wordfilter_filter_process() directly against a form value. If the returned text is not equal to the original text you could act on this and fail validation for the form field perhaps.
Comment #2
jgoodwill01 commentedAny suggestions on what this might look like. I've been trying to figure out how to validate using Wordfilter.
Comment #3
rickvug commentedI needed this so I created a very small module called wordfiler_plus. Here's the code. Add an info file and rename the module/functions as needed. Work is still needed to integrate with CCK and provide a more helpful error message. I hope this helps someone in the mean time.
Comment #4
rickvug commentedI also chucked this code up on GitHub is anyone is interested. See http://github.com/rickvug/wordfilter_plus. If this gets into a workable state maybe I'll make a patch to wordfilter for better integration or throw the code up on d.o. Anyone is welcome to fork and improve.
Comment #5
websites-development.com commentedCheck out this code:
http://websites-development.com/blog/bad-words-validation-drupal
Comment #6
rickvug commentedAlso see this sandbox: http://drupal.org/sandbox/rickvug/1072642. If anyone is interested please contact me about becoming a co-maintainer. Should this become useful we can transition the sandbox to be a full project with releases.