Jump to content
Sign in to follow this  
CoderJim

Bulk delete 'bot created' customers

Recommended Posts

Like many others I have been deluged with bogus 'customers' created by bots and mechanical turks, I see a possible solution in a past post (2/3/16) by member avyona where they said they had used this code in their phpMyAdmin to clean the DB...

"DELETE FROM `CubeCart_customer` WHERE order_count  =  0 AND registered < 1460000000;

or even better:

DELETE FROM `CubeCart_customer` WHERE order_count  =  0;

It will clean house in a second!"

Has anyone tried this with the current 6.2.2 CC Foundation and/or is this a risky move?

Thanks

Jim

Share this post


Link to post
Share on other sites

I have modded a CC6 store such that in the Customer List, there is a checkbox on each line and a "Do this for each selected..." drop-down selector.

Depending how many bogus customers you wish to delete, that is to say, how long this has been happening and how much you have let accumulate, it could take you five to twenty minutes to clear them out.

Plus, a simple edit to index.php will test for a few key aspects of these form submissions and then tell PHP to simply die.

 

Share this post


Link to post
Share on other sites

The second sql statement will delete all records in the customer table that have never placed an order.  The first is a variation that deletes the same but only when they were registered before a specific time

1 hour ago, CoderJim said:

is this a risky move?

Implementing sql statements that delete records without knowing what they do would always be risky !

Share this post


Link to post
Share on other sites

I went one step further on one of my sites.

By exporting the customer and also the address table, I could identify which customers had never purchased then cross reference these to thier address entries.

Delete both and import the tables back in.

Using PHP my admin, you could narrow these down to anything, say prior to 12 months ago, and only delete the customers who registered and never purchased say prior to 2018.

 

One thing I would suggest, is using PHPMyadmin, make a copy of the table and work on the copy.

 

Share this post


Link to post
Share on other sites

Thanks for all the help, I will certainly be looking into this soon and report my conclusion.

Note: I always save a copy before working on a file I did not create, good idea for anyone doing this type of work.

Share this post


Link to post
Share on other sites

Okay, so in CC 6.2.4 with bsmither's help (I assume) and the provided solution, it worked beautifully and this command was not required. I will be using it regularly.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...