Add deleted_user action. Props Denis-de-Bernardy. see #9422
git-svn-id: http://svn.automattic.com/wordpress/trunk@10894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
953709c72a
commit
f17cf80acd
|
@ -412,6 +412,9 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
|||
|
||||
$id = (int) $id;
|
||||
|
||||
// allow for transaction statement
|
||||
do_action('delete_user', $id);
|
||||
|
||||
if ($reassign == 'novalue') {
|
||||
$post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );
|
||||
|
||||
|
@ -429,7 +432,6 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
|||
}
|
||||
|
||||
// FINALLY, delete user
|
||||
do_action('delete_user', $id);
|
||||
|
||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
|
||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
|
||||
|
@ -440,6 +442,9 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
|||
wp_cache_delete($user->user_login, 'userlogins');
|
||||
wp_cache_delete($user->user_email, 'useremail');
|
||||
|
||||
// allow for commit transaction
|
||||
do_action('deleted_user', $id);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue