Subscription info not rendered in user view modes

Created on 9 August 2023, 11 months ago
Updated 19 February 2024, 4 months ago

Problem/Motivation

The Supscription info of a user is not rendered when viewing that user.

Steps to reproduce

  • Install the mailchimp module and link it with your Mailchimp account.
  • Install the mailchimp_lists module.
  • Add a Mailchimp subscription field to the user entity and link it to an existing Mailchimp list.
  • Enabled the Mailchimp subscription field in the default view mode of the user entity with the option Display subscription info.
  • Save

Now I would expect to see some info whether that user is subscribed or not. But the field is not rendered.

πŸ› Bug report
Status

Active

Version

2.2

Component

Lists Module

Created by

πŸ‡³πŸ‡±Netherlands ecvandenberg

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

Comments & Activities

  • Issue created by @ecvandenberg
  • πŸ‡ΊπŸ‡ΈUnited States en-cc-org

    Same issue; mailchimp 2.2.2 on Drupal 9.5.10. Summary of my test findings:

    The mailchimp subscription field stays NULL unless/until the user is manually opened for edit and saved (with or without any changes made to the user). Manually opening a user for edit pulls in the data from Mailchimp; for example you'll see the checkbox is automatically selected and interest groups populated IF the user's email exists in Mailchimp AND is a subscriber. If the user's email doesn't exist in Mailchimp OR exists there but is not subscribed, the checkbox will not be selected. Manually saving that user populates the field in the database, after which the user's profile will display either Subscribed or Not Subscribed (instead of being NULL). AFTER this manual open/save, the module is THEN able to update subscription status when any further changes are made on either side. How to avoid manually opening/saving thousands of users? Neither VBO nor Feeds is able to initially bulk populate the NULL mailchimp subscription field.

    Searching the issue queue, found an old/D7 script, so I updated it for D9.
    1. Load the user via \Drupal::entityTypeManager()->getStorage('user')->load($i); or \Drupal\user\Entity\User::load($i);
    2. Make any change (for example, add a role)
    3. Save the user via save();
    The script updates & saves the user BUT the mailchimp subscription field is NOT updated.

    What does the manual open/save do that allows it to initially access Mailchimp data, and how can I incorporate programmatically?

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

    The exact situation we're going through. About 13K users and the field is null. New signups are being recorded as they should, but the older accounts are not synced properly with their MC accounts. If we edit/save, then they resync, and the information is updated.

  • πŸ‡ΊπŸ‡ΈUnited States en-cc-org

    I ended up creating a browser automation script to do the initial sync. I used UIPath but I'm sure anything that can use a browser to programmatically load a user in edit mode & save will work. I had to babysit it as it ran through thousands of users, sometimes timing/erroring out, but better than hours and hours of manual work (or incorrect data).

Production build 0.69.0 2024