Skip to content

Commit

Permalink
add user group data to the object
Browse files Browse the repository at this point in the history
  • Loading branch information
ipula committed Jan 9, 2025
1 parent 731d834 commit 320171b
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions pages/invitation/InvitationHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
use PKP\invitation\core\enums\InvitationAction;
use PKP\invitation\core\Invitation;
use PKP\invitation\stepTypes\SendInvitationStep;
use PKP\userGroup\relationships\UserUserGroup;
use PKP\userGroup\UserGroup;

class InvitationHandler extends Handler
{
Expand Down Expand Up @@ -301,7 +303,7 @@ public function editUser($args, $request): void
),
]);
$templateMgr->assign([
'pageComponent' => 'PageOJS',
'pageComponent' => 'Page',
'breadcrumbs' => $breadcrumbs,
'pageWidth' => TemplateManager::PAGE_WIDTH_FULL,
]);
Expand All @@ -316,6 +318,20 @@ public function editUser($args, $request): void
*/
private function getUserUserGroups(int $id): array
{
return Repo::userGroup()->userUserGroups($id)->toArray();
$userGroups = [];
$userUserGroups = UserUserGroup::query()
->withUserId($id)
->get()
->toArray();
foreach ($userUserGroups as $key => $userUserGroup) {
if($userUserGroup['userGroupId'] != 1){
$userGroups[$key] = $userUserGroup;
$userGroups[$key]['masthead'] = $userUserGroup['masthead'] === 1;
$userGroups[$key]['name'] = Repo::userGroup()
->get($userUserGroup['userGroupId'])
->toArray()['name'][Locale::getLocale()];
}
}
return $userGroups;
}
}

0 comments on commit 320171b

Please sign in to comment.