You are here

function notifications_ui_node_form_submit in Notifications 5

Form submission, node subscriptions form

1 call to notifications_ui_node_form_submit()
notifications_ui_notifications in notifications_ui/notifications_ui.module
Implementation of hook_notifications.

File

notifications_ui/notifications_ui.module, line 188
User Interface for subscriptions modules

Code

function notifications_ui_node_form_submit($form_id, $form_values) {
  $uid = $form_values['subscriptions']['account']->uid;
  foreach ($form_values['subscriptions']['options'] as $index => $value) {
    $subscription = $form_values['subscriptions']['params'][$index] + array(
      'uid' => $uid,
      'event_type' => 'node',
    );
    if ($value) {
      notifications_save_subscription($subscription);
    }
    elseif (!empty($subscription['sid'])) {
      notifications_delete_subscription($subscription['sid']);
    }
  }
  drupal_set_message(t('Your subscriptions have been updated.'));
}