mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Don't delete everything if there are no posts.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1207 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
cf06e8e7f6
commit
b93876eb46
@ -138,21 +138,22 @@ case 'delete':
|
||||
die(__('Can’t delete a user whose level is higher than yours.'));
|
||||
|
||||
$post_ids = $wpdb->get_col("SELECT ID FROM $tableposts WHERE post_author = $id");
|
||||
$post_ids = implode(',', $post_ids);
|
||||
|
||||
// Delete comments, *backs
|
||||
$wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID IN ($post_ids)");
|
||||
// Clean cats
|
||||
$wpdb->query("DELETE FROM $tablepost2cat WHERE post_id IN ($post_ids)");
|
||||
// Clean post_meta
|
||||
$wpdb->query("DELETE FROM $tablepostmeta WHERE post_id IN ($post_ids)");
|
||||
// Clean links
|
||||
$wpdb->query("DELETE FROM $tablelinks WHERE link_owner = $id");
|
||||
// Delete posts
|
||||
$wpdb->query("DELETE FROM $tableposts WHERE post_author = $id");
|
||||
// FINALLY, delete user
|
||||
$wpdb->query("DELETE FROM $tableusers WHERE ID = $id");
|
||||
|
||||
if ($post_ids) {
|
||||
$post_ids = implode(',', $post_ids);
|
||||
|
||||
// Delete comments, *backs
|
||||
$wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID IN ($post_ids)");
|
||||
// Clean cats
|
||||
$wpdb->query("DELETE FROM $tablepost2cat WHERE post_id IN ($post_ids)");
|
||||
// Clean post_meta
|
||||
$wpdb->query("DELETE FROM $tablepostmeta WHERE post_id IN ($post_ids)");
|
||||
// Clean links
|
||||
$wpdb->query("DELETE FROM $tablelinks WHERE link_owner = $id");
|
||||
// Delete posts
|
||||
$wpdb->query("DELETE FROM $tableposts WHERE post_author = $id");
|
||||
// FINALLY, delete user
|
||||
$wpdb->query("DELETE FROM $tableusers WHERE ID = $id");
|
||||
}
|
||||
header('Location: users.php?deleted=true');
|
||||
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user