Addition of: can_delete_(post|user|...) filters
|Reported by:||5ubliminal||Owned by:||westi|
Any delete_* action should be preceded by a can_delete_* filter to allow plugins to prevent deletion of ... stuff. And:
if(apply_filters('can_delete_user', true, $user_ID) == false) return false;
E.g.: I have a plugin that deletes users who have no logged in for 3 months. But when I issue wp_delete_user I want to allow other plugins to prevent deletion. Let's say that user has bought something from my blog. I want to keep it even if administrator tries to delete it.
This way ... if I choose 50 users to delete I could just internally skip those un-deletable. I know I can wp_die when I don't want to delete a user [on delete_user] but I'd rather protect the user silently than having to delete again after de-selecting that user from the selection.
E.g.: Inside wp_delete_user ... instead of:
if(!apply_filters('can_delete_user', true, $id)) return false; do_action('delete_user', $id);
PS: Hope I make any sense.