Do not allow deletion of a super admin user through wpmu_delete_user().

In step with the UI provided by `wp-admin/network/users.php`, super admin privileges must be removed before a user can be deleted through the API.

Props @johnjamesjacoby, @jeremyfelt.
Fixes #32935.


git-svn-id: https://develop.svn.wordpress.org/trunk@33143 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jeremy Felt
2015-07-09 16:15:30 +00:00
parent b9ef1b8533
commit bb7f147703
2 changed files with 59 additions and 0 deletions
+7
View File
@@ -190,6 +190,13 @@ function wpmu_delete_user( $id ) {
if ( !$user->exists() )
return false;
// Global super-administrators are protected, and cannot be deleted.
$_super_admins = get_super_admins();
if ( in_array( $user->user_login, $_super_admins, true ) ) {
return false;
}
/**
* Fires before a user is deleted from the network.
*