Include moderated groups in UserGroupCondition
authorMatthias Schmidt <gravatronics@live.com>
Fri, 6 Mar 2015 17:44:28 +0000 (18:44 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 6 Mar 2015 17:44:28 +0000 (18:44 +0100)
wcfsetup/install/files/lib/system/condition/UserGroupCondition.class.php

index 531d57388ad91a27477373e6857cbccd9c60e7cf..8a50bbddb720bf29c858ee90ccbfd496034aefdf 100644 (file)
@@ -150,17 +150,15 @@ HTML;
         */
        protected function getUserGroups() {
                if ($this->userGroups == null) {
-                       $groupTypes = array(UserGroup::OTHER);
-                       if ($this->includeguests) {
-                               $groupTypes[] = UserGroup::GUESTS;
+                       $invalidGroupTypes = array(
+                               UserGroup::EVERYONE,
+                               UserGroup::USERS
+                       );
+                       if (!$this->includeguests) {
+                               $invalidGroupTypes[] = UserGroup::GUESTS;
                        }
                        
-                       $this->userGroups = UserGroup::getGroupsByType($groupTypes);
-                       foreach ($this->userGroups as $key => $userGroup) {
-                               if (!$userGroup->isAccessible()) {
-                                       unset($this->userGroups[$key]);
-                               }
-                       }
+                       $this->userGroups = UserGroup::getAccessibleGroups(array(), $invalidGroupTypes);
                        
                        uasort($this->userGroups, function(UserGroup $groupA, UserGroup $groupB) {
                                return strcmp($groupA->getName(), $groupB->getName());