Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Delete Multiple Users Quickly. Rate Topic   - - - - -

 
  • allgaguzzi
  • Member
  • Trial users
  • Join Date: 31-Aug 11
  • 39 posts

Posted 11 December 2019 - 03:46 PM #1

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

 

 



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19982 posts

Posted 12 December 2019 - 05:51 AM #2

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


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 997 posts

Posted 12 December 2019 - 10:47 AM #3

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

Team of SoftSolid
cs-cart.pl

 
  • allgaguzzi
  • Member
  • Trial users
  • Join Date: 31-Aug 11
  • 39 posts

Posted 12 December 2019 - 04:03 PM #4

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;



 
  • allgaguzzi
  • Member
  • Trial users
  • Join Date: 31-Aug 11
  • 39 posts

Posted 12 December 2019 - 04:24 PM #5

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?



 
  • soft-solid
  • Junior Member
  • Authorized Reseller
  • Join Date: 19-Apr 10
  • 997 posts

Posted 12 December 2019 - 05:47 PM #6

Hello

 

Please try

ALTER TABLE ?:users AUTO_INCREMENT = 1;

 

Not tested !

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19982 posts

Posted 13 December 2019 - 05:21 AM #7

In the phpMyAdmin run

ALTER TABLE cscart_users AUTO_INCREMENT = 33000;

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    Multi-Vendor PLUS           USD 3100 (2775)
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      Multi-Vendor Ultimate       USD 7500 (6000)

 
  • allgaguzzi
  • Member
  • Trial users
  • Join Date: 31-Aug 11
  • 39 posts

Posted 13 December 2019 - 08:46 AM #8

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