Skip to content
Snippets Groups Projects
Commit 40d1e605 authored by Tom Ashe's avatar Tom Ashe Committed by Jonathan Sacksick
Browse files

Issue #3371850 by TomTech: Drupal 10.1: fatal error on account creation

parent 00362f6b
No related branches found
No related tags found
No related merge requests found
......@@ -156,14 +156,14 @@ class ProfileFormWidget extends WidgetBase implements ContainerFactoryPluginInte
$property = ['profiles', $profile_type->id()];
$profile = $form_state->get($property);
if (!$profile) {
if (!$account->isAnonymous()) {
if ($account->isAuthenticated()) {
$profile = $profile_storage->loadByUser($account, $profile_type->id());
}
if (!$profile) {
$values = [
'type' => $profile_type->id(),
];
if (!$account->isAnonymous()) {
if ($account->isAuthenticated()) {
$values['uid'] = $account->id();
}
$profile = $profile_storage->create($values);
......
......@@ -43,7 +43,7 @@ class ProfileEntityFieldItemList extends FieldItemList implements EntityReferenc
$profile_storage = \Drupal::entityTypeManager()->getStorage('profile');
// Ignore anonymous and user accounts not saved yet.
if ($user->isAnonymous()) {
if (!$user->isAuthenticated()) {
return [];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment