You are here

function messaging_admin_message_form_submit in Messaging 5

Same name and namespace in other branches
  1. 6 messaging.admin.inc \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.module, line 272

Code

function messaging_admin_message_form_submit($form_id, $form_values) {
  $group = $form_values['group'];
  foreach ($form_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');
}