You are here

function faq_ask_notify_expert in FAQ_Ask 6.2

Send an expert notification

Parameters

int $uid: The user id of the expert

array $data: Structure containing the parameters for the e-mail

1 call to faq_ask_notify_expert()
faq_ask_submit in ./faq_ask.module

File

./faq_ask.module, line 516
This module is an add-on to the FAQ module that allows users with the 'ask question' permission to create a question which will be queued for an 'expert' to answer.

Code

function faq_ask_notify_expert($uid, $data) {
  $account = user_load(array(
    'uid' => $uid,
  ));
  $data['account'] = $account;
  $mail_sent = drupal_mail('faq_ask', 'notify_expert', $account->mail, user_preferred_language($account), $data);
  if ($mail_sent) {
    watchdog('FAQ_Ask', 'Expert notification email sent to @to', array(
      '@to' => $account->mail,
    ), WATCHDOG_NOTICE);

    //    drupal_set_message(t('Expert notification email sent to @to',  array('@to' => $account->mail)));
  }
  else {
    watchdog('FAQ_Ask', 'Expert notification email to @to failed for the "@cat" category.', array(
      '@to' => $account->mail,
      '@cat' => check_plain($data['category']),
    ), WATCHDOG_ERROR);

    //    drupal_set_message(t('Expert notification email failed for the "!cat" category.', array('!cat' => check_plain($data['category']))));
  }
}