We have a lot of spammers (which are logged in users) creating content on our site. They are creating photo nodes without photos (which I have recently allowed as a way to catch them and ignore them, sort of a honeypot). I have also added the honeypot module but the 10 second delay doesn't seem to be working too well...

Is there a way to catch these nodes that don't have photos and block them from ever actually being created? I was thinking that it could be done in the presave hook, but unsetting the node didn't seem to work.


I could make the image required, but the bot is filling out all of the required fields so far, and it isn't hard to upload an image using a script.

I have implemented what I put in my answer and it seems to work, and I am giving the spammers 10 tries/day before they get banned. This may or may not be too lenient.

So far I have caught and banned 14 spam accounts (~1 hour of it being live).

  • 1
    Is there any reason you can't make the images a required field? – Chapabu Mar 19 '13 at 18:16
  • I would, but then they would upload photos. See the addition to the question. – SeanJA Mar 19 '13 at 20:53

I think you should mark the image filed as required the bot won't be able to create the nodes without attached image.

  • I would, but then they would upload photos. See the addition to the question. – SeanJA Mar 19 '13 at 20:58
  • In this case, you should use drupal_goto() function instead of setting the header manually. – hosszu.kalman Mar 19 '13 at 21:02
  • Ah, good point... I will do that – SeanJA Mar 23 '13 at 2:59

Maybe this is the solution... doesn't create the node, sends them to a blank 403 page.

function _utils_photo_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
    case 'presave':
        //try again?
        die(header('Location: /node/add/photo', TRUE));
//meta code
function _utils_check_spammer($uid){
    if (in_spam_table && spam_count > spam_limit_for_today)
        //nice knowing you...
        //you get some more chances
  • 264 spam accounts blocked, this seems to be a good way to catch them – SeanJA Mar 23 '13 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.