function answers_notify_new_answer in Answers 7
Same name and namespace in other branches
- 6.2 includes/answers.notify.inc \answers_notify_new_answer()
- 7.2 includes/answers.notify.inc \answers_notify_new_answer()
- 7.3 includes/answers.notify.inc \answers_notify_new_answer()
1 call to answers_notify_new_answer()
- _answers_notify_node_insert in includes/
answers.notify.inc
File
- includes/
answers.notify.inc, line 88 - Notification functions for the 'Answers' module
Code
function answers_notify_new_answer($nid) {
global $user;
$question = node_load($nid);
$notify_p = $question->field_notify_p['und'][0]['value'];
// extract the nid of the question
if ($notify_p) {
$question_user = user_load($question->uid);
$params = array(
'!question_user_name' => $question_user->name,
'!answer_user_name' => $user->uid == 0 ? 'anonymous' : $user->name,
'!question_title' => $question->title,
'!question_url' => url('node/' . $nid, array(
'absolute' => TRUE,
'target' => '_blank',
)),
'!site' => variable_get('site_name', 'drupal'),
);
drupal_mail('answers', 'new_answer', $question_user->mail, user_preferred_language($question_user), $params);
}
}