Skip to content

Commit bed5f4e

Browse files
pkp#11031 Return default user group if is empty (pkp#11052)
1 parent 928e011 commit bed5f4e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pages/submission/PKPSubmissionHandler.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -623,10 +623,12 @@ protected function getSubmitUserGroups(Context $context, User $user): Collection
623623
// Users without a submitting role can submit as an
624624
// author role that allows self registration
625625
if ($userGroups->isEmpty()) {
626-
$userGroups = UserGroup::withContextIds([$context->getId()])
626+
$defaultUserGroup = UserGroup::withContextIds([$context->getId()])
627627
->withRoleIds([Role::ROLE_ID_AUTHOR])
628628
->permitSelfRegistration(true)
629-
->get();
629+
->first();
630+
631+
$userGroups = collect($defaultUserGroup ? [$defaultUserGroup->id => $defaultUserGroup] : []);
630632
}
631633

632634
return $userGroups;

0 commit comments

Comments
 (0)