From: Matthias Schmidt Date: Sun, 14 Apr 2019 15:03:00 +0000 (+0200) Subject: Allow selection of non-admin group for owner if no admin group exists X-Git-Tag: 5.2.0_Alpha_1~136^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=423e6e3a7a8cb70c1ead120249d0b494e3197aa2;p=GitHub%2FWoltLab%2FWCF.git Allow selection of non-admin group for owner if no admin group exists See #2890 --- 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(); });