Message Subscribe sends emails regardless of context

Created on 31 October 2012, over 11 years ago
Updated 6 January 2024, 6 months ago

I fail to understand the role of "notifiers" in message_subscribe_email and how they interact with the way messages are sent.
From what I've seen, message_subscribe_process_message always sends emails, whether there is an "email" notifier in the $uids options or not.

Maybe some (pseudo) code would help :

/**
 * Implements hook_entity_insert().
 */
function coopnet_subscribe_entity_insert($entity, $type) {
  //...
  $message = message_create('coopnet_notifications_message', array('arguments' => $arguments), user_load($entity->uid));
  message_subscribe_process_message($type, $entity, $message, array('email' => array()), array('save message' => FALSE), $context);
}

Although the user 4003 has not flagged my content with an "email_*" flag related to my content, email is sent anyway.

In message_subscribe_message_subscribe_get_subscribers, the $uids array looks like this :

array (
  //...
  3521 => 
  array (
    'notifiers' => 
    array (
      'email' => 'email',
    ),
    'flags' => 
    array (
      0 => 'follow_user',
    ),
  ),
  4003 => 
  array (
    'notifiers' => 
    array (
    ),
    'flags' => 
    array (
      0 => 'follow_user',
    ),
  ),
)

But user 4003 is sent an email.

Am I missing something here ?

πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡«πŸ‡·France jide

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024