foreach ($fields as $fieldName => $field) {
$customFieldName = 'custom_' . ($field['custom_field_id'] ?? NULL);
if ($field['type'] === ['Custom'] && isset($membershipParams[$customFieldName])) {
foreach ($fields as $fieldName => $field) {
$customFieldName = 'custom_' . ($field['custom_field_id'] ?? NULL);
if ($field['type'] === ['Custom'] && isset($membershipParams[$customFieldName])) {