Ok so I have created 3 vocabularies, each of which has a single term created.

In the user notifications page for tags I see a form with a checkbox for each term in the 3 vocabularies.

Selecting a term and submitting fails to successfully save the selected term.

I have traced this to the logic in notifications_tags_user_form_submit()

function notifications_tags_user_form_submit($form_id, $form_values) {
  // Regroup parameters and pass on
  $values = array();
  foreach ($form_values['subscriptions'] as $vid => $terms) {
    foreach ($terms as $tid => $term_values) {
      $values[$tid] = $term_values;
    }
  }
  $form_values['subscriptions'] = $values;
  return notifications_content_form_submit($form_id, $form_values);
}

When you step through the $terms array, each $tid is equal to the string 'checkbox' and
$term_values is an array consisting of $tid as key and boolean (1|0) as $term_values for
checkbox state.

Since you are looping through the vocabularies here, each time the call to
$values[$tid] = $term_values is made, you are overwriting the previous vocab/term
result in the form since 'checkbox' is always the key to the $values array. So in my
case I was checking the 1st term and the subsequent unchecked 2nd and 3rd terms
overwrite the checked term. I tested this out by checking the last term which when
submitted does successfully save the tag subscription.

Comments

jose reyero’s picture

Status: Active » Fixed

Yes, you are right, good analysis.
Fixed (and simplified the form logic)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.