X-Cart Delete Duplicate User Accounts

Category: X-Cart Snippets
Added:
Enter Price $
SKU SKU82112222
Quantity

If your authentication mode (Tools > Maintenance) is currently set to 'Username' and you wish to change to 'Email', you may be prevented, due to you having user accounts that share the same email address.

Deleting them manually can be a pain, especially if there are lots of them, but these SQL patches will delete duplicate accounts in one go!

Make a database backup first, or at the very least, backup the 'xcart_customers' table!


OPTION 1 - Keep the oldest account, apply this SQL patch...

DELETE x1 FROM xcart_customers x1, xcart_customers x2 WHERE x1.id > x2.id AND x1.email = x2.email AND x1.username != 'admin' AND x1.username != 'provider' AND x1.username != 'master';

OPTION 2 - Keep the newest account, apply this SQL patch...

DELETE x1 FROM xcart_customers x1, xcart_customers x2 WHERE x1.id < x2.id AND x1.email = x2.email AND x1.username != 'admin' AND x1.username != 'provider' AND x1.username != 'master';


Note the ending code...

AND x1.username != 'admin' AND x1.username != 'provider' AND x1.username != 'master';

Add more admin / provider account usernames if necessary, so they are left untouched!

Tested. X-Cart Classic only. Hope it helps.

The website uses cookies to allow us to better understand how the site is used. By continuing to use this site, you consent to this policy.
More Information