Closed (fixed)
Project:
Privatemsg
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 May 2010 at 11:18 UTC
Updated:
26 Jan 2011 at 01:17 UTC
Hi,
is there a possibility to delete all (read) messages?
Or, as a feature request, i think it would be a great option to be able to automaticly delete read messages after x days.
Thanks for this great module,
Nilsja
Comments
Comment #1
berdirWe decided against doing something like this.
Instead, #69856: Message limits, allows you do limit how many messages a user can have, which gives them control over which they want to delete.
You can delete messages/threads with http://blog.worldempire.ch/de/api/function/privatemsg_thread_change_dele... and http://blog.worldempire.ch/de/api/function/privatemsg_message_change_del.... But to get these, you need a custom query, our query builder currently does not support that (for all users, it does for a single user).
Comment #2
nilsja commentedthank you for the infos. in my case it is not a quota, but a security/privacy concern. i want to be able to delete all messages with one click.
so perhaps is a delete script directly via mysql the better way? is their any danger by deleting the complete pm_index pm_messages and pm_attachments? or would unsinstalling the module also do this?
TRUNCATE TABLE `pm_index`
TRUNCATE TABLE `pm_messages`
TRUNCATE TABLE `pm_attachments`
Comment #3
berdirYes, uninstall/re-install would do the same thing. Depending on the number of modules you've installed, there might also be other tables (like tags)
That will obviously delete everything.
Comment #4
nilsja commentedhere is my solution: i activated the php filter module. don't forget to allow this in your /admin/settings/filters, and only for the admin user.
then i created a block called "red button" which is only visible to user role webteam and inserted the following php code:
the success messages are kind of useless because there is no error handling.
i think this is really ugly code. sorry, i'm not a programmer. but it works for me. so if anybody wants to improve it: missing wrong password message and error handling...
Comment #5
naheemsays commentedI would not recommend the use of the php filter module as using php in blocks/nodes could be a recipe for disaster.
You could do as Berdir mentioned in comment 3 - disable and then uninstall the module. That will delete all settings and tables linked to privatemsg. When you re-enable, everything would be recreated.
Comment #6
nilsja commentedi have to limit it to a role, so the uninstall variant doesnt work for me. the webteam role should not be able to administer all modules...
Comment #7
berdirYes, but still, placing PHP code in blocks is a very bad idea you should instead create a simple module (or place it in a existing one) and provide a block/link through that.
Comment #8
nilsja commentedok, you insisted :)
here is the lousy beginning of my first module (do not install it!):
privatemsgdel.info:
privatemsgdel.module:
perhaps somebody wants to finish it, or teach me how to do it...
nilsja
Comment #10
mardok commentedBulk Delete Module:
http://drupal.org/project/bulkdelete
Comment #11
rikimaru0007 commentedHello, in Site Configuration > Privatemsg > Private Messages (tab)
How about the checkbox, Flush (deleted messages)
I would like to know the manual flush in database
by using this code below in SQL tab phpMyAdmin
db_query("TRUNCATE {what?!}");
These are the available replacement for the what?! above.
pm_block_user
pm_email_notify
pm_index
pm_message
pm_tags
pm_tag_index
I'm looking for... Something like pm_deleted but it hasn't.