- Issue created by @Leo Pitt
- Merge request !4Don't require a selected contact list unless there was a contact_list value... → (Open) created by Leo Pitt
I receive an "'Unable to finish subscription. Please contact website support.'" error when adding a sign up on a form where a default list is configured but no other list is shown.
Alter the code block in SubscribeForm.php:
// Check if all API call were successful.
if (!$activecampaign_contact_id || empty($is_in_default_contact_list) || empty($is_in_selected_contact_list)) {
$this->messenger()->addError(
$config['failed_message']
?? $this->t('Unable to finish subscription. Please contact website support.')
);
}
This conditional will always return false in this scenario, as
$is_in_selected_contact_list
will always be empty, as there is no selected contact list.
This conditional should only fail when
$is_in_selected_contact_list
is empty AND a contact list was selected in the sign up form.
Suggest the conditional is changed to:
// Check if all API call were successful.
if (!$activecampaign_contact_id || empty($is_in_default_contact_list) || (!$form_state->isValueEmpty('contact_list') && empty($is_in_selected_contact_list))) {
// ...
}
Active
1.0
Code