You are here

function hook_registration_send_broadcast_alter in Entity Registration 8

Same name and namespace in other branches
  1. 8.2 registration.api.php \hook_registration_send_broadcast_alter()
  2. 7.2 registration.api.php \hook_registration_send_broadcast_alter()
  3. 7 registration.api.php \hook_registration_send_broadcast_alter()

Allow modules to alter registration entity settings prior to sending email to all registrants.

This could be used, for example, to allow users to opt-out of broadcast emails.

Parameters

array $registrations:

array $context: array( 'entity_type' => $entity_type, 'entity_id' => $entity_id, );

File

./registration.api.php, line 77
API documentation for Relation module.

Code

function hook_registration_send_broadcast_alter(&$registrations, $context) {

  // Loop through each registration.
  foreach ($registrations as $reg_id => $registration) {

    // Only send broadcast email for registrations where
    // user registered themself; not other user or anonymous.
    if (!($registration->user_uid == $registration->author_uid) || !empty($registration->anon_mail)) {
      unset($registrations[$reg_id]);
    }
  }
}