Sort user groups by name in UserOptionListForm
authorMatthias Schmidt <gravatronics@live.com>
Mon, 7 Apr 2014 14:58:26 +0000 (16:58 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Mon, 7 Apr 2014 14:58:26 +0000 (16:58 +0200)
wcfsetup/install/files/lib/acp/form/UserOptionListForm.class.php

index 195fbd4b79eab3bb497b27914e6e0bb6469906f6..d304f6347acde0e48106e84b93e2c1e454c25cc0 100644 (file)
@@ -30,7 +30,13 @@ abstract class UserOptionListForm extends AbstractOptionListForm {
         * @return      array
         */
        protected function getAvailableGroups() {
-               return UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS));
+               $userGroups = UserGroup::getAccessibleGroups(array(), array(UserGroup::GUESTS, UserGroup::EVERYONE, UserGroup::USERS));
+               
+               uasort($userGroups, function(UserGroup $groupA, UserGroup $groupB) {
+                       return strcmp($groupA->getName(), $groupB->getName());
+               });
+               
+               return $userGroups;
        }
        
        /**