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

Commit fa72e2f

Browse files
committed
feat: Add support for getting the best display group for a linked account.
1 parent 79e495a commit fa72e2f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Api/Controller/Linking.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ public function actionGet(ParameterBag $params)
3838
$this->assertSuperUserKey();
3939
$this->assertApiScope('linking');
4040

41-
$finder = \XF::finder('YogstationPermissions:LinkedAccount');
41+
$linked_account_finder = \XF::finder('YogstationPermissions:LinkedAccount');
42+
$group_finder = \XF::finder('XF:UserGroup');
4243

43-
$linked_account = $finder->where('account_id', $params->account_id)
44+
$linked_account = $linked_account_finder->where('account_id', $params->account_id)
4445
->where('account_type', $params->account_type)
4546
->with('User')->fetchOne();
4647

@@ -49,8 +50,13 @@ public function actionGet(ParameterBag $params)
4950
return $this->error(\XF::phrase('yg_no_linked_account'));
5051
}
5152

53+
$user = $linked_account->User;
54+
$group = $group_finder->where('user_group_id', $user->display_style_group_id)->fetchOne();
55+
56+
$user['display_group'] = $group;
57+
5258
return $this->apiSuccess([
53-
'user' => $linked_account->User
59+
'user' => $user,
5460
]);
5561
}
5662
}

0 commit comments

Comments
 (0)