View Full Version : Delete all attachments for user
Kevlar
03-27-2013, 02:39 AM
Is there anyway to delete all the attachments for a user in vB4? I banned a user with over 800 attachments which serve no value to my forum. Is there an easy way to delete them without going through 80 pages of attachments in the admincp?
ForceHSS
03-27-2013, 03:33 AM
Login to his account or from admin panel is the only way
Zachery
03-27-2013, 03:36 AM
How are your attachments stored?
Kevlar
03-27-2013, 01:15 PM
How are your attachments stored?
In the file system ... currently we have about 40GB of attachments.
Brandon Sheley
03-27-2013, 04:34 PM
You could do it with a sql query if you wanted, sorry I don't have the query for you though.
Kevlar
03-28-2013, 12:59 PM
How would a SQL query delete the attachments in the file system?
Zachery
03-28-2013, 04:43 PM
If you know the user, and the userid
go to /path/to/attachments/u/s/e/r/I/d/
This folder has their attachment files.
Kevlar
03-28-2013, 11:19 PM
Ok... so I can delete the user's folder with their attachments in it. Cool, but what about the database?
delete from attachment where userid = (userid)?
Zachery
03-29-2013, 06:07 PM
No, don't delete the users folder, the subfolder in there are for others. Just delete the attachment files.
Deleting them from the database gets more complicated. It'd probably be easier to manually reset the user's passwird and just go into his usercp and delete all of his attachments.
Kevlar
03-30-2013, 03:25 PM
There has to be a better way... at 20 attachments per page (and this guy has 800 attachments), this is going to take forever. Plus not to mention this is just one user. There are probably hundreds that have to be done.
snakes1100
03-30-2013, 03:41 PM
Does the user show up in your "Five Users Whose Attachments Take Up the Most Space" via the attachment stats?
If so, you can click view attachments of that user there, then do a select all, on each page, as it shows only 10 per page.
That will remove the files & the info from the post, not the fastest nor the easiest in your case of 800.
Change line 671 of admincp/attachment.php to 50 or 100 or higher etc...
$vbulletin->GPC['search']['results'] = 10;
You could also modify the link below if they arent.
http://www.yoururlhere.com/forums/admincp/attachment.php?do=search&search[attachedby]=USERNAME HERE
Kevlar
04-07-2013, 06:15 PM
I will give this a shot and see what happens. I am hoping that will help solve the problem. The attachment stats though causes my server to timeout, so I will try by that new URL you provided.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.