You are here

function classified_notifications_mail in Classified Ads 6.3

Same name and namespace in other branches
  1. 7.3 modules/classified_notifications/classified_notifications.module \classified_notifications_mail()

Implements hook_mail().

@TODO support multiple languages, based on user language, not site language

1 call to classified_notifications_mail()
ClassifiedNotificationsTest::test1491880 in tests/classified_notifications.test
Issue 1491880.

File

modules/classified_notifications/classified_notifications.module, line 119
Optional notification features for classified module

Code

function classified_notifications_mail($key, &$message, $params) {
  if (in_array($key, array(
    'half-life',
    'pre-expire',
    'expire',
    'pre-purge',
    'purge',
  ))) {
    $source = array(
      'subject' => _classified_get('notifications-' . $key . '-subject'),
      'body' => _classified_get('notifications-' . $key . '-body'),
    );
    $data = array();
    foreach ($source as $part => $value) {
      $data[$part] = token_replace_multiple($value, array(
        'global' => NULL,
        'user' => $params['account'],
      ), '[', ']', $params);
    }
    $message = array_merge($message, $data);
  }
}