After updating to 2.2.3, user email field not available on user merge fields

Created on 20 September 2024, 2 months ago

After updating from 2.2.2 to 2.2.3 the fields available on the user bundle for Email under Merge Fields are many fewer and the email field is no longer available. Looking through the commits between 2.2.2 and 2.2.3 it seems that πŸ› mailchimp_lists_load_email fails to find email address field when attached to a related entity. Needs work could be the cause but I'm not able to verify that.

With 2.2.2:

With 2.2.3:

πŸ› Bug report
Status

Active

Version

2.2

Component

General

Created by

πŸ‡ΊπŸ‡ΈUnited States tjhellmann Indianapolis, IN

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @tjhellmann
  • πŸ‡ΊπŸ‡ΈUnited States xenophyle

    Are you able to experiment with 2.2.4 to see if that fixes it?

  • πŸ‡ΊπŸ‡ΈUnited States tjhellmann Indianapolis, IN

    Thank you @xenophyle. Sorry, I should have mentioned that the issue persists after updating to 2.2.4. 2.2.2 was the last version where the email field was an option. With 2.2.4 the options look the same as the ones I posted with the screenshot with 2.2.3.

  • πŸ‡ΊπŸ‡ΈUnited States xenophyle

    Using these steps, I was not able to reproduce the problem; I was still seeing the full set of options for email address.

    -Install Mailchimp 2.2.2 on a standard Drupal install of 10.3
    -Enable Mailchimp and Mailchimp Audiences
    -Authenticate with OAuth
    -Create a subscription field on users
    -Set email address merge field to the user email property
    -Update to Mailchimp 2.2.4 and clear caches

    Is there any additional information you might be able to supply? Are you using any patches?

  • πŸ‡ΊπŸ‡ΈUnited States tjhellmann Indianapolis, IN

    I was able to test more and the culprit was a feeds_item field on the user account.

    Within the loop in the getFieldmapOptions function in modules/mailchimp_lists/src/Plugin/Field/MailchimpListsSubscription.php the feeds_item field returns FALSE from $options = $this->getOptionsForSubEntity($required, $field_definition, $target_definition, $target_type, $keypath, $label, $options); which resets/empties the $options array. That's why I was only seeing the values in the loop that came after the feeds_item field after updating to 2.2.3.

    I'm not sure of the best way but it seems that we should check if getOptionsForSubEntity returns a value that isn't FALSE.

  • πŸ‡ΊπŸ‡ΈUnited States xenophyle

    Great tip! I just updated 2.x-dev with a change I think should fix this. Do you want to see if it helps?

  • πŸ‡ΊπŸ‡ΈUnited States tjhellmann Indianapolis, IN

    Yes, that fixed it. We have all the fields back as options now. Thank you!

Production build 0.71.5 2024