From 423e6e3a7a8cb70c1ead120249d0b494e3197aa2 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 14 Apr 2019 17:03:00 +0200 Subject: [PATCH] Allow selection of non-admin group for owner if no admin group exists See #2890 --- .../files/lib/acp/form/UserGroupPromoteOwnerForm.class.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php b/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php index e78aff11c5..365a3985ed 100644 --- a/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php @@ -57,6 +57,12 @@ class UserGroupPromoteOwnerForm extends AbstractForm { $this->groups = array_filter($this->groups, function (UserGroup $group) { return $group->isAdminGroup(); }); + + if (empty($this->groups)) { + // fallback for broken installations without an admin group + $this->groups = UserGroup::getGroupsByType([UserGroup::OTHER]); + } + uasort($this->groups, function(UserGroup $a, UserGroup $b) { return $a->getName() <=> $b->getName(); }); -- 2.20.1