• I would like to run a cron job every evening that goes through my comments table and deletes any new comments that don’t have an email address. Everyone who comments on my site leaves an email address, and I’ve noticed that none of the spam comments have email. I’m already running Kitten’s Spaminator and SpamKarma, but things are still getting through (like last week when over 100 new comments appeared overnight). I figure if I have this cron job set up I’ll be covered most of the way…but I have no idea how to run those things. Can someone help?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Do you have ssh access to your host ?

    No email address and they get through those plugins ?
    Very Odd.
    What wp version ?

    Thread Starter tmountjr

    (@tmountjr)

    I’m still running Mingus. My university firewall is very picky when it comes to FTP, and I haven’t had time to upload the latest version; I probably will over the summer, though. On the other hand, I just finished clearing out 53 spams this morning, only 40 of which were moderated.

    I’m not sure if I have SSH access, but I do know there’s a cron scheduling app in cPanel X, which is what my host is running. Simple question, probably: how do I know if I have SSH?

    Well if you have cron scheduling that is fine. Now you just need the mysql code for select and delete ??

    Thread Starter tmountjr

    (@tmountjr)

    And that’s fine, but do I just paste it in there? I read somewhere on Google that one had to create a text file, then execute some sort of command to get the sql file to run. All i have to do is pop in the SQL in that line?

    Problem with the SQL, though – the following doesn’t return any records:

    SELECT * FROM comments WHERE comments_author_email IS NULL;

    I exported the SQL of that table, and one of the offending comments is:

    INSERT INTO comments VALUES (1178, 192, 'propecia online', '', 'https://****.com', '63.144.244.130', '2005-04-21 14:28:46', '2005-04-21 18:28:46', '<trackback />propecia online\nIf a little knowledge is dangerous, where is a man who has so much as to be out of danger? by levitra', 0, '0', 0);

    I tried searching for comments where comment_author_email is “”, ”, and NULL; I’ve also tried writing my own SQL – nothing shows up. What am I doing wrong? I know exactly how I’d do this in an Access db, but this isn’t an access db!

    Thread Starter tmountjr

    (@tmountjr)

    Never mind – I fiddled some more. The SQL I used is:

    DELETE FROM comments WHERE comment_author_email = "" AND comment_ID >325

    I’m thinking this would also catch legitimate trackbacks, too, right?

    Thread Starter tmountjr

    (@tmountjr)

    Okay, scrap that – I guess there is some sort of command I have to run, because the SQL that works in PHPMyAdmin doesn’t work as a cron job:

    /bin/sh: line 1: DELETE: command not found

    That’s from the email report my server sent me.

    I am just exploring this. I would think that the cron job itself simply runs a script. The script accesses mysql and deletes stuff then lets you know its done it. We are going to need to consult the great sages at mysql.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Deleting comments via cron’ is closed to new replies.