[wp-trac] [WordPress Trac] #10810: Addition of: can_delete_(post|user|...) filters
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 18 16:15:20 UTC 2009
#10810: Addition of: can_delete_(post|user|...) filters
-------------------------+--------------------------------------------------
Reporter: 5ubliminal | Owner: westi
Type: enhancement | Status: new
Priority: high | Milestone: 2.8.5
Component: Plugins | Version: 2.8.4
Severity: blocker | Keywords:
-------------------------+--------------------------------------------------
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:
{{{
do_action('delete_user', $id);
}}}
set:
{{{
if(!apply_filters('can_delete_user', true, $id)) return false;
do_action('delete_user', $id);
}}}
PS: Hope I make any sense.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10810>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list