Change record status: 
Project: 
Introduced in branch: 
4.x
Introduced in version: 
4.0.0-alpha3
Description: 

User interface changes

1) The “Subscribers” list page (/admin/people/simplenews) changes to match the new data model (see below). Please check your view after upgrade as you may want to adjust it, or reset back to the new default.

  • Rename "Active" column to "Status", with 3 values: ACTIVE, BLOCKED, UNCONFIRMED. Remove the “Subscriber Status” filter, and add “Unconfirmed” to the "Status" filter.
  • Unconfirmed subscriptions are now listed in their own row (instead of being part of the row for the confirmed subscriber).

2) Subscriber forms:

  • The fields created, subscriptions and langcode now use standard core widgets, instead of the previous hard-coded form fields.
  • Of these, created and subscriptions are configurable in manage form display, but langcode is not.
  • The default settings are a fairly close match to the previous hard-coded settings.

API changes

  • Add Subscriber::sendConfirmation().
  • Subscriber::setStatus() and Subscriber::getStatus() now use an integer with 3 possible values: ACTIVE, BLOCKED, UNCONFIRMED (instead of boolean). Add shortcut functions isActive() and isConfirmed().
  • Remove Subscriber::getChanges()/setChanges().
  • Both Subscriber::subscribe() and Subscriber::unsubscribe() now take only one parameter.
  • Add new parameter Subscriber::loadByMail($checkTrust = FALSE). If TRUE, then call skipConfirmation() and if FALSE force creating a new subscriber and set it to unconfirmed.
  • In Subscriber::loadByUid(), add a new parameter $confirmed = TRUE. if TRUE only return a confirmed subscriber.
  • In Subscriber::loadByMail(), add a new parameter $check_trust = FALSE. If TRUE and the current user is untrusted then force creating a new subscriber.
  • In SubscriptionManager::subscribe()/unsubscribe(), remove $confirm and $source parameters. This function now always acts as if $confirm is FALSE. To send a confirmation, the calling code needs to group changes together using a Subscriber object:
    • Subscriber::loadByUid()
    • Modify subscriptions
    • Subscriber::sendConfirmation()
  • In SubscriptionManager, remove sendConfirmations(), addConfirmation(), requiresConfirmation(), reset().
  • New parameter on Subscriber::fillFromAccount() to allow copying of only base fields.
  • Remove Subscriber::getSubscription(). To check the current subscription use isSubscribed() and for history check SubscriberHistory entities.

Data model changes

The Subscriber entity changes as follows:

  • Remove changes field.
  • Change the subscriptions field to be entity_reference, delete @FieldType simplenews_subscription.
  • Change status field to a tiny int, with 3 values: ACTIVE, BLOCKED, UNCONFIRMED.

New SubscriberHistory entity.

Impacts: 
Site builders, administrators, editors
Module developers
Themers
Site templates, recipes and distribution developers