Allow selection of non-admin group for owner if no admin group exists
authorMatthias Schmidt <gravatronics@live.com>
Sun, 14 Apr 2019 15:03:00 +0000 (17:03 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 14 Apr 2019 15:03:00 +0000 (17:03 +0200)
See #2890

wcfsetup/install/files/lib/acp/form/UserGroupPromoteOwnerForm.class.php

index e78aff11c50d8d0d8ed63d6ae416afdfce39b0c1..365a3985edbd8b15792e63d2bff22d55eedd8782 100644 (file)
@@ -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();
                });