You are here

function campaignmonitor_user_delete in Campaign Monitor 8

Same name and namespace in other branches
  1. 8.2 campaignmonitor.module \campaignmonitor_user_delete()

Implements hook_ENTITY_TYPE_delete.

Parameters

\Drupal\Core\Entity\EntityInterface $entity:

File

./campaignmonitor.module, line 69
Module that plugs in Campaign Monitor functionality to your Drupal web site. For Campaign Monitor information see: http://www.campaignmonitor.com/.

Code

function campaignmonitor_user_delete(EntityInterface $entity) {

  // Unsubscribe users when deleted.
  $mail = $entity
    ->get('mail')
    ->getValue()[0]['value'];
  $lists = campaignmonitor_get_lists();
  foreach ($lists as $list_id => $values) {
    campaignmonitor_unsubscribe($list_id, $mail);
  }
}