function classified_notifications_classified_notify_alter in Classified Ads 6.3
Same name and namespace in other branches
- 7.3 modules/classified_notifications/classified_notifications.module \classified_notifications_classified_notify_alter()
Implements hook_classified_notify_alter().
Parameters
array $ads_bunch:
string $kind:
Return value
void
See also
_classified_get_notify_kinds()
File
- modules/
classified_notifications/ classified_notifications.module, line 61 - Optional notification features for classified module
Code
function classified_notifications_classified_notify_alter($ads_bunch, $kind) {
foreach ($ads_bunch as $uid => $ads) {
$account = user_load($uid);
$account->ads = $ads;
// Do not notify anonymous account or users without mail.
if (!$account->uid || !$account->mail) {
continue;
}
$params['account'] = $account;
$message = drupal_mail('classified_notifications', $kind, $account->mail, user_preferred_language($account), $params, NULL, FALSE);
// do not send immediately
job_queue_add('drupal_mail_send', t('Classified Ads: lifetime notifications (@kind) for !name (@mail)', array(
'!name' => l($account->name, 'user/' . $account->uid),
'@kind' => $kind,
'@mail' => $account->mail,
)), array(
$message,
));
}
}