You are here

function classified_notifications_classified_purge_alter in Classified Ads 6.3

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

Implements hook_classified_purge_alter().

Parameters

array $ads_bunch:

Return value

void

File

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

Code

function classified_notifications_classified_purge_alter($ads_bunch) {
  foreach ($ads_bunch as $uid => $ads) {
    $account = user_load($uid);
    $account->ads = $ads;
    if (!$account->uid || !$account->mail) {

      // do not notify anonyms or users without mail
      continue;
    }
    $params['account'] = $account;
    $message = drupal_mail('classified_notifications', 'purge', $account->mail, user_preferred_language($account), $params, NULL, FALSE);

    // do not send immediately
    job_queue_add('drupal_mail_send', t('Classified Ads: purge notifications for !name (@mail)', array(
      '!name' => l($account->name, 'user/' . $account->uid),
      '@mail' => $account->mail,
    )), array(
      $message,
    ));
  }
}