You are here

function messaging_admin_message_form_submit in Messaging 6

Same name and namespace in other branches
  1. 5 messaging.module \messaging_admin_message_form_submit()
  2. 6.2 messaging.admin.inc \messaging_admin_message_form_submit()
  3. 6.3 messaging.admin.inc \messaging_admin_message_form_submit()

Process and save message parts

File

./messaging.admin.inc, line 217
Messaging Framework - Admin UI

Code

function messaging_admin_message_form_submit($form, &$form_state) {
  $group = $form_state['values']['group'];
  foreach ($form_state['values']['messages'] as $key => $messages) {
    foreach ($messages as $method => $text) {
      db_query("DELETE FROM {messaging_message_parts} WHERE type = '%s' AND msgkey = '%s' AND method = '%s'", $group, $key, $method);
      if ($text = trim($text)) {
        db_query("INSERT INTO {messaging_message_parts} (type, msgkey, method, module, message) VALUES('%s', '%s', '%s', '', '%s')", $group, $key, $method, $text);
      }
    }
  }
  drupal_set_message('The messages have been updated');
}