forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: Patrick on March 16, 2005, 09:59:03 pm

Title: Deleting pictures by username
Post by: Patrick on March 16, 2005, 09:59:03 pm
Is it possible to delete all pictures from a certain member without having to go through all albums and deleting them one by one?
Title: Re: Deleting pictures by username
Post by: foulu on March 17, 2005, 01:35:16 am
possible, but i think you must make a new php file !!!
Title: Re: Deleting pictures by username
Post by: kegobeer on March 17, 2005, 03:28:36 am
You can use phpmyadmin to do that.

DELETE cpg132_pictures, cpg132_comments, cpg132_votes
FROM cpg132_pictures
LEFT JOIN cpg132_comments on cpg132_pictures.pid=cpg132_comments.pid
LEFT JOIN cpg132_votes on cpg132_pictures.pid=cpg132_votes.pic_id
WHERE cgp132_pictures.owner_id=56

In that example, 56 is the user_id who's pictures you want to delete.  This sql statement deletes all the pictures from the pictures table and all the comments and votes that belong to those pictures, where the owner of the pictures is #56.
Title: Re: Deleting pictures by username
Post by: foulu on March 17, 2005, 03:32:30 am
but image still in server, only database delete
Title: Re: Deleting pictures by username
Post by: kegobeer on March 17, 2005, 03:39:03 am
Yes, they would still be on the server.  But all of those files should be in the userpics/10056 directory, so they would be easy enough to remove.

The hard part is cleaning up the database; the easy part is deleting the original, thumb_, and normal_ pictures.

It would be possible to write a file that would read the filenames and locations into an array, unlink those files, thumbnails, and normal images, then execute the above sql statement.  I'm not volunteering, mind you.  Just saying it's possible.
Title: Re: Deleting pictures by username
Post by: foulu on March 17, 2005, 03:42:27 am
i'm not agree with you, hard part is delete file, with large gallery and if this user upload many file, find and delete is hell.

sorry, i'm wrong, all pics of an user is store in one folder do delete is easy.


Title: Re: Deleting pictures by username
Post by: kegobeer on March 17, 2005, 03:50:58 am
I guess your users upload using the XP Publisher utility, which creates a new directory for each date.  Otherwise, all of their images go into one directory.  Unless you allow your users to FTP images to any directory they want and do batch adds, in which case they would be administrators.