diff options
-rw-r--r-- | reminder.module | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/reminder.module b/reminder.module index a32390e..024aa30 100644 --- a/reminder.module +++ b/reminder.module @@ -333,39 +333,40 @@ function reminder_node_submit($node, $form, &$form_state) { } } - else { - - // reminder head - $node_id = db_query("SELECT nid FROM {reminder_reminder_heads} WHERE admin_url = :admin_url", array(':admin_url' => $form_state['values']['reminder_admin_url']))->fetchField(); - $node = node_load($node_id); - - // save node options - $node->title = $form_state['values']['title']; - $node->body = $form_state['values']['body']; - node_save($node); - - // save reminder options - db_update('reminder_reminder_heads')->fields(array( - 'anonym_name' => $form_state['values']['anonym']['user_name'], - 'anonym_email' => $form_state['values']['anonym']['user_email'], - 'secure' => $form_state['values']['reminder_options']['secure'], - ))->condition('nid', $node_id)->execute(); - - // days and options - - // collect the ids of the days which are already in the db - // insert and update days and options datas - // if there is some unused id in $days_ids, that's mean we deleted them - - foreach (reminder_parse_subscribers($node->reminder_subscriptions) as $subscriber) { - $unsubscribe_url = reminder_generate_url('unsubscribe_url', 30); - $values = array( - 'email' => $subscriber, - 'reminder_id' => $node->nid, - 'unsubscribe_url' => $unsubscribe_url, - ); - } - $query = db_insert('reminder_subscriptions')->fields($values); + } + else { + + // reminder head + $node_id = db_query("SELECT nid FROM {reminder_reminder_heads} WHERE admin_url = :admin_url", array(':admin_url' => $form_state['values']['reminder_admin_url']))->fetchField(); + $node = node_load($node_id); + + // save node options + $node->title = $form_state['values']['title']; + $node->body = $form_state['values']['body']; + node_save($node); + + // save reminder options + db_update('reminder_reminder_heads')->fields(array( + 'anonym_name' => $form_state['values']['anonym']['user_name'], + 'anonym_email' => $form_state['values']['anonym']['user_email'], + 'secure' => $form_state['values']['reminder_options']['secure'], + ))->condition('nid', $node_id)->execute(); + + // days and options + + // collect the ids of the days which are already in the db + // insert and update days and options datas + // if there is some unused id in $days_ids, that's mean we deleted them + + foreach (reminder_parse_subscribers($node->reminder_subscriptions) as $subscriber) { + $unsubscribe_url = reminder_generate_url('unsubscribe_url', 30); + $values = array( + 'email' => $subscriber, + 'reminder_id' => $node->nid, + 'unsubscribe_url' => $unsubscribe_url, + ); + } + $query = db_insert('reminder_subscriptions')->fields($values); } // TODO |