From dda59949de059ad8b37b6547c1d131ca6a82aef8 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 3 May 2010 23:04:42 +0000 Subject: [PATCH] User deletion fixes. Props yoavf. fixes #13242 git-svn-id: http://svn.automattic.com/wordpress/trunk@14422 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/user.php | 4 ++-- wp-admin/users.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index a64ce07fa4..2375db7727 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -451,6 +451,8 @@ function wp_delete_user( $id, $reassign = 'novalue' ) { $wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) ); } + clean_user_cache($id); + // FINALLY, delete user if ( !is_multisite() ) { $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) ); @@ -460,8 +462,6 @@ function wp_delete_user( $id, $reassign = 'novalue' ) { $wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = $id AND meta_key = '{$level_key}'"); } - clean_user_cache($id); - // allow for commit transaction do_action('deleted_user', $id); diff --git a/wp-admin/users.php b/wp-admin/users.php index 6a99b6e751..88b36a1d71 100644 --- a/wp-admin/users.php +++ b/wp-admin/users.php @@ -102,6 +102,7 @@ case 'dodelete': case 'delete': if ( current_user_can('delete_user', $id) ) wp_delete_user($id); + break; case 'reassign': if ( current_user_can('delete_user', $id) ) wp_delete_user($id, $_REQUEST['reassign_user']);