mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-10-05 15:16:59 +00:00
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:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user