You are here

function subscriptions_nodes_list_form_submit in Subscriptions 5

submit the subscriptions_node_list form

File

./subscriptions.module, line 1106

Code

function subscriptions_nodes_list_form_submit($form_id, $form_values) {
  if ($form_id == 'subscriptions_nodes_list_form') {
    foreach ($form_values as $n => $v) {
      if (substr($n, 0, 4) == 'subs' && $v == 0) {

        // if value != 1, delete associated subscription row
        db_query('DELETE FROM {subscriptions} WHERE sid = %d AND uid = %d AND stype = \'%s\'', substr($n, 4), $form_values['user'], 'node');
        $deactivated = TRUE;
      }
    }
    $deactivated ? drupal_set_message(t('Your subscription(s) was deactivated.')) : '';
  }
}