File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,11 +111,14 @@ public function actionCreate(?string $section = null): ?Response
111111 $ entry = Craft::createObject (Entry::class);
112112 $ entry ->siteId = $ site ->id ;
113113 $ entry ->sectionId = $ section ->id ;
114- $ entry ->setAuthorIds (
115- $ this ->request ->getQueryParam ('authorIds ' ) ??
116- $ this ->request ->getQueryParam ('authorId ' ) ??
117- $ user ->id
118- );
114+
115+ if ($ section ->maxAuthors !== 0 ) {
116+ $ entry ->setAuthorIds (
117+ $ this ->request ->getQueryParam ('authorIds ' ) ??
118+ $ this ->request ->getQueryParam ('authorId ' ) ??
119+ $ user ->id
120+ );
121+ }
119122
120123 // Type
121124 if (($ typeHandle = $ this ->request ->getParam ('type ' )) !== null ) {
Original file line number Diff line number Diff line change @@ -3015,10 +3015,11 @@ private function maybeSetDefaultAttributes(): void
30153015 return ;
30163016 }
30173017
3018+ $ section = $ this ->getSection ();
30183019 if (
3019- empty ( $ this -> getAuthors ()) &&
3020- ! isset ( $ this -> fieldId ) &&
3021- $ this ->getSection ()-> type !== Section:: TYPE_SINGLE
3020+ $ section ?->type !== Section:: TYPE_SINGLE &&
3021+ $ section ?->maxAuthors !== 0 &&
3022+ empty ( $ this ->getAuthors ())
30223023 ) {
30233024 $ user = Craft::$ app ->getUser ()->getIdentity ();
30243025 if ($ user ) {
You can’t perform that action at this time.
0 commit comments