You are here

function subscriptions_content_mail_edit_submit in Subscriptions 5.2

Custom submit handler for mail_edit_form().

File

./subscriptions_content.module, line 898
Subscriptions to content events

Code

function subscriptions_content_mail_edit_submit($form_id, $form_values) {
  include_once drupal_get_path('module', 'subscriptions_mail') . '/subscriptions_mail.templates.inc';
  foreach (array(
    'digest_item' => SUBSCRIPTIONS_DIGEST_MAILKEY . '-item',
    'digest_item_comment' => SUBSCRIPTIONS_DIGEST_MAILKEY . '-item-comment',
    'digest_separator' => SUBSCRIPTIONS_DIGEST_MAILKEY . '-separator',
    'comment_body' => SUBSCRIPTIONS_COMMENT_MAILKEY . '-item',
    'comment_separator' => SUBSCRIPTIONS_COMMENT_MAILKEY . '-separator',
  ) as $key => $value) {
    if (isset($form_values[$key])) {
      db_query("UPDATE {subscriptions_mail_edit} SET item_body = '%s' WHERE mailkey = '%s'", $form_values[$key], $value);
      if (!db_affected_rows()) {
        db_query("INSERT INTO {subscriptions_mail_edit} (item_body, mailkey) VALUES ('%s', '%s')", $form_values[$key], $value);
      }
    }
  }
}