Notification sent only when some words are used
wwwoliondorcom - April 11, 2009 - 21:38
| Project: | Admin Notify |
| Version: | 5.x-1.1 |
| Component: | Documentation |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Notification only when some words are used ? To control spam.
Hello,
I wonder if it would be easy for you to add a function to send notifications only when content is post using some words as viagra, casino, etc... to try to fight spammers ? I searched a lot and couldn't find a module, but found other users looking for that kind of function.
Thanks a lot for your help.

#1
in the admin_notify_nodeapi function you can try replacing this:
drupal_mail('Admin Notify Email',$admin_email, $subject, $body, $from = NULL, $headers = array());by this:
$isItSpam = FALSE;
if (strpos($node->body,"keyword1")) $isItSpam = TRUE;
if (strpos($node->body,"keyword2")) $isItSpam = TRUE;
if ($isItSpam) drupal_mail('Admin Notify Email',$admin_email, $subject, $body, $from = NULL, $headers = array());
what it will do is check if there is keyword1 or keyword2 in the node's body, and will send the notification only if one of the keyword is found in the node's body. You can also do it with $node->title which is the node's title.
This is quick and dirty way of doing it, some developper could do an admin interface for entering the keywords quite easily.
#2