From 55ba72f46eca175da0caceb6043877cc2afbde54 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sat, 2 Feb 2013 04:41:02 +0000 Subject: [PATCH] Confirm a user exists before deleting them in wp_delete_user() and wpmu_delete_user(). props scribu, fixes #23067. git-svn-id: http://core.svn.wordpress.org/trunk@23380 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ms.php | 3 +++ wp-admin/includes/user.php | 3 +++ 2 files changed, 6 insertions(+) diff --git a/wp-admin/includes/ms.php b/wp-admin/includes/ms.php index b62e1d0b2d..9350a77dc8 100644 --- a/wp-admin/includes/ms.php +++ b/wp-admin/includes/ms.php @@ -135,6 +135,9 @@ function wpmu_delete_user( $id ) { $id = (int) $id; $user = new WP_User( $id ); + if ( !$user->exists() ) + return false; + do_action( 'wpmu_delete_user', $id ); $blogs = get_blogs_of_user( $id ); diff --git a/wp-admin/includes/user.php b/wp-admin/includes/user.php index 1d60aa57e3..ea3bdbf6a9 100644 --- a/wp-admin/includes/user.php +++ b/wp-admin/includes/user.php @@ -240,6 +240,9 @@ function wp_delete_user( $id, $reassign = 'novalue' ) { $id = (int) $id; $user = new WP_User( $id ); + if ( !$user->exists() ) + return false; + // allow for transaction statement do_action('delete_user', $id);