Fixed assignment to default user groups during user rebuild
authorMarcel Werk <burntime@woltlab.com>
Sat, 12 Aug 2017 11:46:34 +0000 (13:46 +0200)
committerMarcel Werk <burntime@woltlab.com>
Sat, 12 Aug 2017 11:46:34 +0000 (13:46 +0200)
wcfsetup/install/files/lib/data/user/UserProfileAction.class.php

index 960bc9d7c620949bd14b1727f55d7596e848ee33..6fc9d8372e5b72e19c15a7d21b72a2b032d81955 100644 (file)
@@ -364,10 +364,19 @@ class UserProfileAction extends UserAction {
                                $fixUserGroupIDs[$user->userID] = [UserGroup::EVERYONE];
                                $groupIDs[] = UserGroup::EVERYONE;
                        }
-                       if (!in_array(UserGroup::USERS, $groupIDs)) {
-                               if (!isset($fixUserGroupIDs[$user->userID])) $fixUserGroupIDs[$user->userID] = [];
-                               $fixUserGroupIDs[$user->userID][] = UserGroup::USERS;
-                               $groupIDs[] = UserGroup::USERS;
+                       if ($user->activationCode) {
+                               if (!in_array(UserGroup::GUESTS, $groupIDs)) {
+                                       if (!isset($fixUserGroupIDs[$user->userID])) $fixUserGroupIDs[$user->userID] = [];
+                                       $fixUserGroupIDs[$user->userID][] = UserGroup::GUESTS;
+                                       $groupIDs[] = UserGroup::GUESTS;
+                               }
+                       }
+                       else {
+                               if (!in_array(UserGroup::USERS, $groupIDs)) {
+                                       if (!isset($fixUserGroupIDs[$user->userID])) $fixUserGroupIDs[$user->userID] = [];
+                                       $fixUserGroupIDs[$user->userID][] = UserGroup::USERS;
+                                       $groupIDs[] = UserGroup::USERS;
+                               }
                        }
                        $newGroupIDs[$user->userID] = $groupIDs;