You are here

function drupalchat_send_offline_message in DrupalChat 7

Same name and namespace in other branches
  1. 7.2 drupalchat.module \drupalchat_send_offline_message()
1 string reference to 'drupalchat_send_offline_message'
drupalchat_menu in ./drupalchat.module
Implements hook_menu().

File

./drupalchat.module, line 1407
Module code for DrupalChat.

Code

function drupalchat_send_offline_message() {
  if (isset($_POST['drupalchat_m_contact_details']) && isset($_POST['drupalchat_m_message'])) {
    global $user;
    $drupalchat_offline_mail = array();
    $drupalchat_offline_mail['subject'] = 'iFlyChat: Message from Customer';
    $drupalchat_offline_mail['contact_details'] = variable_get('drupalchat_support_chat_offline_message_contact', 'Contact Details') . ': ' . check_plain($_POST['drupalchat_m_contact_details']);
    $drupalchat_offline_mail['message'] = variable_get('drupalchat_support_chat_offline_message_label', 'Message') . ': ' . check_plain($_POST['drupalchat_m_message']);
    $result = drupal_mail('drupalchat', 'offline-message', variable_get('drupalchat_support_chat_offline_message_email', variable_get('site_mail', '')), language_default(), $drupalchat_offline_mail);
    drupal_json_output(array());
  }
  else {
    drupal_access_denied();
  }
}