Deleting pictures by username Deleting pictures by username
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Deleting pictures by username

Started by Patrick, March 16, 2005, 09:59:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Patrick

Is it possible to delete all pictures from a certain member without having to go through all albums and deleting them one by one?

foulu

possible, but i think you must make a new php file !!!

kegobeer

#2
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.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

foulu

but image still in server, only database delete

kegobeer

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.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

foulu

#5
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.



kegobeer

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.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots