function subscriptions_ui_node_form_submit in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions_ui.module \subscriptions_ui_node_form_submit()
- 7 subscriptions_ui.module \subscriptions_ui_node_form_submit()
- 2.0.x subscriptions_ui/subscriptions_ui.module \subscriptions_ui_node_form_submit()
Node subscriptions node subform submit handler.
File
- ./
subscriptions_ui.module, line 300 - Provides a user interface for Subscriptions.
Code
function subscriptions_ui_node_form_submit($form, &$form_state) {
$recipient_uid = $form_state['values']['account']->uid;
$default_send_intervals = $form_state['values']['send_intervals'];
foreach ($form_state['values']['subscriptions'] as $index => $value) {
$params = $form_state['values']['params'][$index];
$args = array(
$params['module'],
$params['field'],
$params['value'],
$params['author_uid'],
$recipient_uid,
);
if ($value) {
$args[] = $default_send_intervals[$index];
$args[] = !empty($form_state['values']['updates'][$index]);
$args[] = !empty($form_state['values']['comments'][$index]);
call_user_func_array('subscriptions_write_subscription', $args);
}
else {
db_query("DELETE FROM {subscriptions} WHERE module = '%s' AND field = '%s' AND value = '%s' AND author_uid = %d AND recipient_uid = %d", $args);
}
}
$form_state['redirect'] = str_replace('/subscribe', '', $_GET['q']);
}