<?php 
defined('ABSPATH') or die('No script kiddies please!!');
if (!empty($form_details['general']['constant_contact_id']) || !empty($std_settings['constant_contact']['constant_contact_lists'])) {
    $post_parameters = array(
        'confirmed' => true,
        'email_addresses' =>
        array(
            array(
                'email_address' => $form_data['std_email'],
                'confirm_status' => 'NO_CONFIRMATION_REQUIRED'
            ),
        ),
        'first_name' => $fname,
        'last_name' => $lname,
    );


    /**
     * std_cc_post_parameters filters parameters being sent to Constant Contact
     *
     * @param array $post_parameters
     * @param array $form_data
     * @param array $form_details
     */
    $post_parameters = apply_filters('std_cc_post_parameters', $post_parameters, $form_data, $form_details);
    $settings_constant_contact_lists_obj = json_decode($std_settings['constant_contact']['constant_contact_lists']);
    $settings_constant_contact_lists = [];
    if (!empty($std_settings['constant_contact']['enable'])) {
        if (!empty($settings_constant_contact_lists_obj)) {
            foreach ($settings_constant_contact_lists_obj as $constant_contact_list) {
                $settings_constant_contact_lists[] = $constant_contact_list->id;
            }
        }
    }
    $constant_contact_lists = (!empty($form_details['general']['constant_contact_id'])) ? $form_details['general']['constant_contact_id'] : $settings_constant_contact_lists;

    if (!empty($constant_contact_lists)) {
        foreach ($constant_contact_lists as $constant_contact_id) {
            $post_parameters['lists'][] = array('id' => $constant_contact_id);
        }
        $this->subscribe_to_cc($constant_contact_id, $post_parameters);
    }
}