Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 79e495a

Browse files
authored
Update GroupUsers.php
1 parent 3ceec13 commit 79e495a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Api/Controller/GroupUsers.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,30 @@ public function actionGet(ParameterBag $params)
4949
"priority" => $group->display_style_priority
5050
];
5151

52-
$query = $userfinder->where($userfinder->expression('FIND_IN_SET(' . $userfinder->quote($group_id) . ", " . $userfinder->columnSqlName("secondary_group_ids") . ")"));
52+
$query = $userfinder->whereOr(
53+
[$userfinder->expression('FIND_IN_SET(' . $userfinder->quote($group_id) . ", " . $userfinder->columnSqlName("secondary_group_ids") . ")")],
54+
["user_group_id", $group_id]
55+
);
5356
$users = $query->fetch();
5457
$new_users = [];
5558
foreach($users as $user) {
59+
$username = "";
5660
foreach($user->LinkedAccounts as $link) {
5761
if($link->account_type !== $account_type) continue;
58-
$new_users[] = $link->account_id;
62+
$username = $link->account_id;
5963
}
64+
if(empty($username)) {
65+
$username = $user->Profile->custom_fields->getFieldValue('Byond');
66+
}
67+
if(empty($username)) {
68+
$username = $user->username;
69+
}
70+
$new_users[] = $username;
6071
}
6172
$group_obj["users"] = $new_users;
73+
if (\XF::$debugMode) {
74+
$group_obj["query"] = $query->getQuery();
75+
}
6276
$response[] = $group_obj;
6377
}
6478

0 commit comments

Comments
 (0)