How to perform a mass delete on blog comments in nopCommerce

We all know that managing an online store is not an easy task. Especially when your store site includes CMS (content management system) features like blog, forums and news etc; maintaining the site is a big undertaking.

If your store site is getting a lot of online traffic there is always a possibility that you will have to deal with "spam". For example: There will be times when you will see spam comments in your blog post. What can you do about it? Well, you can certainly go to administration section and delete those comments. But, what if you are getting thousands of spam comments? Is it really feasible to go to administration section and delete those spam comments one by one?

As of now, nopCommerce does not offer any option to perform a mass delete on blog comment. Today, we will discuss, how to delete blog comments "in mass" directly from the database.

Requirement: You will need access to your SQL database for the store site in order to perform this mass delete task.

Connect to your server and open your SQL database.

nopcommerce delete comments

Use this SQL query to delete "ALL" comments "between" two dates:

DELETE FROM [BlogComment]
WHERE [CreatedOnUtc] between '2015/07/21' and '2016/07/23'
GO


Note: Replace "date values" with your dates

Run this query against your database and all the comments between the "two" dates will be deleted instantly like this:

nopcommerce comments delete

Hope it helps!

About Author

Written By Lavish Kumar

Based out of New York, USA, Lavish Kumar is a full stack web developer by profession and founder of Striving Programmers, a trusted community for developers that offers a wealth of articles and forums to assist individuals with improving their software development skills.

Leave your comment