You are here

function _ed_classified_send_user_notification_email in Classified Ads 5.2

Same name and namespace in other branches
  1. 5 ed_classified_notifications.inc \_ed_classified_send_user_notification_email()
  2. 6.2 ed_classified_notifications.inc \_ed_classified_send_user_notification_email()
  3. 7.2 ed_classified_notifications.inc \_ed_classified_send_user_notification_email()

Send an email notification to the specified user

2 calls to _ed_classified_send_user_notification_email()
_ed_classified_notify_advertisers_periodic in ./ed_classified_notifications.inc
Process "periodic" notifications Create a notification if a user has ads nearing expiration
_ed_classified_notify_user_of_ad_expiration in ./ed_classified_notifications.inc
Notify a user that their ad has expired.

File

./ed_classified_notifications.inc, line 81
user notifications for imple text-based classified ads module Michael Curry, Exodus Development, Inc. exodusdev@gmail.com for more information, please visit http://exodusdev.com Copyright (c) 2006, 2007 Exodus Development, Inc. All Rights Reserved.…

Code

function _ed_classified_send_user_notification_email(&$user, $key = '') {
  $parms = _ed_classified_displayname_parms();
  $params['account'] = $user;
  $params['context'] = array(
    '!sitename' => variable_get('site_name', ''),
    '!user_ads_url' => url('user/' . $user->uid . '/' . EDI_CLASSIFIED_PATH_NAME, array(
      'absolute' => TRUE,
    )),
    '!siteurl' => url('', array(
      'absolute' => TRUE,
    )),
  );
  $params['context'] = array_merge($params['context'], $parms);
  $from = variable_get('site_mail', ini_get('sendmail_from'));

  // http://drupal.org/node/77689
  switch (reset(explode('.', DRUPAL_VERSION))) {
    case 5:
      $message = array();

      // Invoke hook_mail() manually.
      ed_classified_mail($key, $message, $params);
      return drupal_mail($key, $user->mail, $message['subject'], $message['body'], $from);
      break;
    case 6:
    case 7:
      return drupal_mail(EDI_CLASSIFIED_MODULE_NAME, $key, $user->mail, user_preferred_language($user), $params, $from);
      break;
  }
}