Skip to content

Commit

Permalink
Merge pull request #14402 from craftcms/feature/cms-1264-cant-remove-…
Browse files Browse the repository at this point in the history
…users-full-name

allow removal of fullName
  • Loading branch information
brandonkelly authored Feb 17, 2024
2 parents 4a397dd + 3e01ed0 commit bc78071
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Slideout sidebars are now always toggleable; not just when the slideout is too narrow to show the sidebar alongside the content. ([#14418](https://github.com/craftcms/cms/pull/14418))
- Field Layout Designers now hide the component library sidebar in favor of “Add” disclosure menus, when they’re too narrow to show the sidebar alongside configured tabs. ([#14411](https://github.com/craftcms/cms/pull/14411))
- Fixed a bug where it wasn’t possible to clear out users’ full names once they were set. ([#14402](https://github.com/craftcms/cms/pull/14402))

## 5.0.0-beta.2 - 2024-02-15

Expand Down
9 changes: 8 additions & 1 deletion src/elements/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,14 @@ public function setAttributes($values, $safeOnly = true): void
}
}

if (array_key_exists('firstName', $values) || array_key_exists('lastName', $values)) {
if (array_key_exists('fullName', $values)) {
// Clear out the first and last names.
// They'll get reset from prepareNamesForSave() if fullName isn't empty.
$this->firstName = null;
$this->lastName = null;
} elseif (array_key_exists('firstName', $values) || array_key_exists('lastName', $values)) {
// Clear out the full name.
// It'll get reset from prepareNamesForSave() if the first/last names aren't empty.
$this->fullName = null;
}

Expand Down

0 comments on commit bc78071

Please sign in to comment.