Hi, I'm looking to block comments containing 'http://' or 'www.' in the name, subject, email or comment body fields. I would like PHP to prevent the comment from posting instead of JavaScript due to spam-bot/bastards still getting past my captcha...

Is this possible? I haven't a clue where/how to do this.

Thanks for any help

Comments

Azol’s picture

Rules (http://drupal.org/project/rules) module is your friend.

fiasst-1’s picture

Hi thanks for your suggestion Azol but im using Drupal 5 and was hoping for a simpler solution to an upgrade.

Anyone?

Azol’s picture

That means you are facing the task of programming it by yourself, correct?
Then take a look at hook_comment (http://api.drupal.org/api/function/hook_comment/5), you most likely will have to process $op=="validate" operations - your PHP code will check comment's body and title and strip all "bad words" from it, for example. I am not a developer, but you can search for code snippets on using these hooks.

fiasst-1’s picture

That looks like the job! thanks, ill look into it.