You are here

function hook_registration_send_broadcast_ENTITY_TYPE_alter in Entity Registration 7

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

Allow modules to alter registration entity settings for a specific node type 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 104
API documentation for Relation module.

Code

function hook_registration_send_broadcast_ENTITY_TYPE_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]);
    }
  }
}