Skip to content

Commit

Permalink
Log sync errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed May 26, 2023
1 parent 8574ef9 commit c9c2ff1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Release Notes for Campaign

## 2.7.2 - 2023-05-26
### Changed
- Errors are now logged when syncing users to contacts fail.

### Fixed
- Fixed a bug in which custom field values were not being imported when importing contacts via CSV files ([#390](https://github.com/putyourlightson/craft-campaign/issues/390)).

Expand Down
3 changes: 3 additions & 0 deletions src/services/SyncService.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ public function syncUserMailingList(User $user, MailingListElement $mailingList)
$contact->setFieldValues($user->getFieldValues());

if (!Craft::$app->getElements()->saveElement($contact)) {
$errors = implode('. ', $contact->getErrorSummary(true));
Campaign::$plugin->log('Couldn’t sync user. {errors}', ['errors' => $errors]);

return;
}

Expand Down

0 comments on commit c9c2ff1

Please sign in to comment.