Skip to content

Commit 0b4f8c4

Browse files
committed
creating authors bug fix
1 parent 64fc1ba commit 0b4f8c4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/elements/Entry.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,21 +335,21 @@ protected function parseAuthorIds($feedData, $fieldInfo): ?array
335335
if ($element) {
336336
$matchedIds[] = $element->id;
337337
}
338-
}
339338

340-
// Check if we should create the element. But only if email is provided (for the moment)
341-
if ($create && $match === 'email') {
342-
$element = new UserElement();
343-
$element->username = $value;
344-
$element->email = $value;
339+
// Check if we should create the element. But only if email is provided (for the moment)
340+
if ($create && $match === 'email') {
341+
$element = new UserElement();
342+
$element->username = $value;
343+
$element->email = $value;
345344

346-
if (!Craft::$app->getElements()->saveElement($element, true, true, Hash::get($this->feed, 'updateSearchIndexes'))) {
347-
Plugin::error('Entry error: Could not create author - `{e}`.', ['e' => Json::encode($element->getErrors())]);
348-
} else {
349-
Plugin::info('Author `#{id}` added.', ['id' => $element->id]);
350-
}
345+
if (!Craft::$app->getElements()->saveElement($element, true, true, Hash::get($this->feed, 'updateSearchIndexes'))) {
346+
Plugin::error('Entry error: Could not create author - `{e}`.', ['e' => Json::encode($element->getErrors())]);
347+
} else {
348+
Plugin::info('Author `#{id}` added.', ['id' => $element->id]);
349+
}
351350

352-
$matchedIds[] = $element->id;
351+
$matchedIds[] = $element->id;
352+
}
353353
}
354354

355355
return $matchedIds;

0 commit comments

Comments
 (0)