Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: MASS DELETE USERS!  (Read 3465 times)

0 Members and 1 Guest are viewing this topic.

pinkforeversite

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
MASS DELETE USERS!
« on: December 12, 2014, 07:47:11 pm »

I have over 5300 registered users in my gallery, I believe most of them are spam/bots as most have never signed into the gallery. I wanted to delete all users and make the gallery offline to everyone but a view new users. How do I go about deleting all users at once. As the users section in coppermine only brings up 25 at a time that will take me FOREVER to delete 5300.

If anyone could help me that would be amazing. I have looked everywhere I think coppermine 1.4 had a plugin but cant find a new one.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: MASS DELETE USERS!
« Reply #1 on: December 13, 2014, 11:16:57 am »

make the gallery offline to everyone but a view new users.

1) Ask users (visitors) to log in to see your gallery. They can see only login page. No need to put it offline.

Config - User settings - Allow unlogged users (guest or anonymous) access.
No
Yes: thumbnail only
Yes: thumbnail and intermediate image
Yes: thumbnail, intermediate, and full-size image

Set it to No.

Advanced settings: Choose from main menu Users - Groups and choose options from the Access level tab.
You have the same options like in Config, but can restrict even other groups.

2) If you want all your old users to not be able to view your gallery, then make a new group, named it oldusers and set Access level to none. Then move all registred users to oldusers group with phpMyAdmin.

Go in your host control panel - find phpMyAdmin or install  phpMyAdmin plugin http://forum.coppermine-gallery.net/index.php/topic,60908.0.html to have phpMyAdmin directly on your gallery.
In phpMyAdmin click on your coppermine database, click on table usergroups (cpg15x_usergroups or cpg_usergroups) and look at the value (numbers) in group_id for group_name oldusers and Registered (see attachment).
Then click on users table (cpg15x_users or cpg_users) , click SQL  (see attachment if you don't see the SQL button) , click Clear and paste:

Code: [Select]
UPDATE cpg15x_users SET user_group = replace(user_group,"2","110");


Then click GO.

In the code above replace cpg15x with your table prefix. Maybe your users table is named cpg_users or other.
Replace even 110 with the value you have in group_id  for group_name oldusers (see attachment).
Registred users should have value 2 just like me.

If you don't know the name for your coppermine database, look in your_gallery_folder/include/config.inc.php
Open config.inc.php and look at $CONFIG['dbname'] =

I attached screenshoots of my steps for moving users with phpMyAdmin.
« Last Edit: December 13, 2014, 11:38:41 am by allvip »
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: MASS DELETE USERS!
« Reply #2 on: December 13, 2014, 11:28:37 am »

I wanted to delete all users.

1) To delete all inactive users that never activated their account (never clicked the link sent to their email to activate account):

Open your_gallery_folder/include/init.inc.php and paste at the end after }:

Code: [Select]
cpg_db_query("DELETE FROM {$CONFIG['TABLE_USERS']} WHERE user_active = 'NO' AND user_regdate < NOW() - INTERVAL 24 HOUR");

Will not delete users that registered in the last 24 hours. 
If you change in the code above NO to YES, will delete all users from all groups included Admin, even users that uploaded or commented on your gallery.

2) To delete all users from just one group.

Open your_gallery_folder/include/init.inc.php and paste at the end after }

Code: [Select]
cpg_db_query("DELETE FROM {$CONFIG['TABLE_USERS']} WHERE user_group = '2' AND user_regdate < NOW() - INTERVAL 24 HOUR");

2 is the group_id for Registered group. With phpMyAdmin you can see the value for each group.
Change 2 with the value of the group you want to delete.

Will not delete users that registered in the last 24 hours. 
Will delete all users from Registered groups, even users that uploaded or commented on your gallery.

I do know how to do it if users activated their account, but never uploaded or commented on your gallery.
It should work with if pic count and comment count is 0 or if Space used/Quota is  0 then:

Code: [Select]
cpg_db_query("DELETE FROM {$CONFIG['TABLE_USERS']} WHERE user_active = 'YES' AND user_regdate < NOW() - INTERVAL 24 HOUR");
« Last Edit: December 13, 2014, 12:38:14 pm by allvip »
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: MASS DELETE USERS!
« Reply #3 on: December 13, 2014, 01:14:25 pm »

If you have a small number of registred users that commented or uploaded on your gallery then will be very ease to mass delete.
Go to Users - Group and make a new Group. Name it something like Members.
Go to Users and use Sort users by drop down menu. Choose Disk usage descending.
Select the ones that do not have 0 KiB (ignore the ones with 0 KiB) and from With selected drop down menu choose Change primarymembergroup - Select group - Members.

Now all users that commented or uploaded on your gallery will be in group Members and now you can use method 2) from reply#2 to delete all Registred users.

Then you can go back to Users, select again the ones that do not have 0 KiB and change their group back to Registred.

Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.