Skip to content

Commit

Permalink
Fixed #15082
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed May 29, 2024
1 parent 6354e92 commit 3824371
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Fixed a bug where field layout designers weren’t displaying native fields in the library pane when a tab was removed that contained them. ([#15064](https://github.com/craftcms/cms/issues/15064))
- Fixed a bug where recent textual changes could be lost when creating a new inline-editable Matrix block, if the block was created before the autosave had a chance to initiate. ([#15069](https://github.com/craftcms/cms/issues/15069))
- Fixed a bug where the `users/create` command would fail without explaining why, when the maximum number of users had already been reached.
- Fixed a validation error that could occur when saving an entry on Craft Solo. ([#15082](https://github.com/craftcms/cms/issues/15082))

## 5.1.7 - 2024-05-25

Expand Down
11 changes: 9 additions & 2 deletions src/elements/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -2201,8 +2201,15 @@ private function _userPostDate(): ?DateTime
*/
public function beforeValidate(): bool
{
if (!isset($this->_authorIds) && !isset($this->fieldId) && $this->getSection()->type !== Section::TYPE_SINGLE) {
$this->setAuthor(Craft::$app->getUser()->getIdentity());
if (
(!isset($this->_authorIds) || empty($this->_authorIds)) &&
!isset($this->fieldId) &&
$this->getSection()->type !== Section::TYPE_SINGLE
) {
$user = Craft::$app->getUser()->getIdentity();
if ($user) {
$this->setAuthor($user);
}
}

if (
Expand Down

0 comments on commit 3824371

Please sign in to comment.