Delete Multiple Users Quickly.

Hi
Is there a way to quickly delete multiple customers/users?

I am working on the cs-cart update, and i heave imported the customers from the old cs-cart to early .
There is about 33000 users and if i try to change amount displayed user to more then 25-50 with
user_type=C&items_per_page=100
i get crf warning "ErrorAccess denied: Possible CSRF attack"

So is it possible to delete all the customers at once?

Or maibe with the sql command?
They do not have any orders, blogs etc , nothing linked.

Also when i import them in a week or so, are they gonna start from the user_id=33000?

Kind regards

Open the admin.php script and after the following line

require(dirname(__FILE__) . '/init.php');

add

$user_ids = db_get_fields("SELECT user_id FROM ?:users WHERE user_type = ?s", 'C');
if (!empty($user_ids)) {
foreach($user_ids as $uid) {
fn_delete_user($uid);
}
}

Then go to any page in the admin panel to check the result

(!) Not tested

P.S. Even if you delete these users, next new customer will have id = maximum ID before deletion + 1

Hello

If you want to set the autoincrement index then you can use ALTER TABLE your_table AUTO_INCREMENT = 1; (for example)
Then the id of new users may have different values.
Perform these operations on a copy of the database so as not to damage anything.
Best regards
Robert

Thank you so much for the help it worked perfectly:

But indeed the user ids are starting with 32766

Do you think that that might cause any problems for the cs-cart performance?

And Robert which table do you mean?
in
ALTER TABLE your_table AUTO_INCREMENT = 1;

I tried to delete all the users from cscart_users table but it still starts with id's 32770....

Is there atable in the cs-cart where that value is generated?

Hello

Please try

ALTER TABLE ?:users AUTO_INCREMENT = 1;

Not tested !

Best regards

Robert

In the phpMyAdmin run

ALTER TABLE cscart_users AUTO_INCREMENT = 33000;

Thank you so much everybody. You really saved the situation.
the ALTER TABLE cscart_users AUTO_INCREMENT = 12; solved the user id start issue.

Kind regards