Skip to content →

How to remove hundreds of spam comments from a Drupal site

Last updated on March 26, 2017

Print Friendly, PDF & Email

Suffered a spam attack on your Drupal site?  You are in good company. Even with Mollom installed, your site can be overrun faster than a dog with fleas.

To get rid of the thousands and thousands of spam comments, you have two choices.

Either, delete the comments from your MySQL database

To delete spam directly at your MySQL database, you will have to log in to your hosting service.  Then use phpAdmin to find the right table.  And truncate the table to clear out all the comments.

I haven’t tried this but proceed logically and it should work.

Or, delete comments from your front end using a View

  1. Install two modules: Entity API and Views Bulk Operations
  2. Clear your cache
  3. Make a new View at Structure/Views/ and use Comments as your content
  4. Leave the format as Unformatted and set the number of comments as 500 — check the pager
  5. Continue & Edit
  6. Change Content to Fields
  7. Add a Field for Bulk Operations: Comment and set the value as Delete
  8. Remove the filters unless you want them
  9. Save
  10. Go to the View (e.g., http:/yourwebsite.name/spam-control or whatever you called your view)
  11. Start deleting

You need two clicks at the top and you must confirm the list.  It takes a little time and it is probably quicker to delete the table but this was more satisfying and can remain in the background to clean up smaller spam attacks in future.

Published in Drupal

One Comment

  1. Hi

    I had a similar problem. Despite turning off comments, I’ve had 1000’s of spam comments on my posts. I’m yet to figure out how to stop them from posting inspite of disabling comments. They were not showing up on my site as they had to be verified. But it’s a huge wastage on my resource.

    To remove the comments:
    1. Login to phpmyadmin on your host
    2. select * from comments where status=1
    3. quickly look through if these are junk comments
    4. If yes, run this
    5. delete from comments where status=1

    This will clean up unwanted comments.

    PS: The advantage in my case was I did not give a free hand to post comments and they needed an approval. Hence it was easy to remove all those that were not verified and approved.

    Hope this helps.

    Cheers
    Rajeev

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: