User deletion fixes. Props yoavf. fixes #13242

git-svn-id: http://svn.automattic.com/wordpress/trunk@14422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-05-03 23:04:42 +00:00
parent 8c3476d90e
commit dda59949de
2 changed files with 3 additions and 2 deletions

View File

@ -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);

View File

@ -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']);