Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix user group isssue #3365

Merged
merged 1 commit into from May 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions core/classes/Core/User.php
Expand Up @@ -6,7 +6,7 @@
* @author Samerton
* @author Partydragen
* @author Aberdeener
* @version 2.0.2
* @version 2.1.1
* @license MIT
*/
class User {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
}

Expand Down