You are here

function answers_notify in Answers 7.3

Same name and namespace in other branches
  1. 5.2 answers.module \answers_notify()
  2. 6 includes/answers.notify.inc \answers_notify()

Send a notification.

Parameters

string $module: Question node object.

object $question: Question node object.

object $notification: The type of notification.

array $starting_params: Default settings to pass to drupal_mail().

1 call to answers_notify()
answers_notify_new_answer in includes/answers.notify.inc
If configured to, notify question author of an answer.

File

includes/answers.notify.inc, line 50

Code

function answers_notify($module, $question, $notification, array $starting_params) {
  global $user;
  global $base_url;
  $question_author = user_load($question->uid);
  $params = array(
    '!question_user_name' => $question_author->name,
    '!question_title' => $question->title,
    '!question_url' => url('node/' . $question->nid, array(
      'absolute' => TRUE,
      'target' => '_blank',
    )),
    '!question_expiration' => date(DATE_RFC822, answers_field_get_value($question, 'field_question_expiration')),
    '!site' => variable_get('site_name', 'drupal'),
    '!site_url' => $base_url,
  );
  $params = array_merge($params, $starting_params);
  drupal_mail($module, $notification, $question_author->mail, user_preferred_language($question_author), $params);
}