function notifications_ui_options_form_submit in Notifications 6
Same name and namespace in other branches
- 6.2 notifications_ui/notifications_ui.module \notifications_ui_options_form_submit()
- 6.3 notifications_ui/notifications_ui.module \notifications_ui_options_form_submit()
Form submission, node subscriptions form
1 call to notifications_ui_options_form_submit()
- notifications_ui_notifications in notifications_ui/
notifications_ui.module - Implementation of hook_notifications.
File
- notifications_ui/
notifications_ui.module, line 302 - User Interface for subscriptions modules
Code
function notifications_ui_options_form_submit($form, &$form_state) {
$enabled = $disabled = 0;
$form_values = $form_state['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 && empty($subscription['sid'])) {
notifications_save_subscription($subscription);
$enabled++;
}
elseif (!$value && !empty($subscription['sid'])) {
notifications_delete_subscription($subscription['sid']);
$disabled++;
}
}
if ($enabled) {
drupal_set_message(format_plural($enabled, 'A subscription has been created', '@count subscriptions have been created'));
}
if ($disabled) {
drupal_set_message(format_plural($disabled, 'A subscription has been deleted', '@count subscriptions have been deleted'));
}
}