From 6cfd5ffb81c2fbc09b5b052bda2e368bfec08ead Mon Sep 17 00:00:00 2001 From: Partydragen Date: Tue, 9 May 2023 20:04:29 +0200 Subject: [PATCH] Fix user group isssue Closes https://github.com/NamelessMC/Nameless/issues/3363 --- core/classes/Core/User.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/classes/Core/User.php b/core/classes/Core/User.php index 0d2faef8c0..b689b32dc5 100644 --- a/core/classes/Core/User.php +++ b/core/classes/Core/User.php @@ -6,7 +6,7 @@ * @author Samerton * @author Partydragen * @author Aberdeener - * @version 2.0.2 + * @version 2.1.1 * @license MIT */ class User { @@ -130,7 +130,7 @@ private function find(string $value, string $field = 'id'): bool { * @return bool True on success, false if they already have it. */ public function addGroup(int $group_id, int $expire = 0): bool { - if (array_key_exists($group_id, $this->_groups ?? [])) { + if (array_key_exists($group_id, $this->getGroups())) { return false; } @@ -545,6 +545,7 @@ public function getGroups(): array { $default_group = Group::find(1, 'default_group'); $default_group_id = $default_group->id ?? 1; + $this->_groups = []; $this->addGroup($default_group_id); }