rgar( $entry, '1.3' ), 'last_name' => rgar( $entry, '1.6' ), 'phone' => rgar( $entry, '3' ), 'email' => rgar( $entry, '4' ), 'lead_source' => 'Web', 'oid' => $sfdc_oid, 'Campaign_ID' => $Campaign_ID, 'member_status' => 'Web response', 'Inquiring_for__c' => rgar( $entry, '5' ), ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $webtolead_url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); } curl_close($ch); } // Function to send data to Five9 function postFiveNine( $entry, $form ) { $Campaign_ID = '701130000026vNy'; $F9list = "Web Form Submissions H"; $F9domain = "connect america"; $permalink = getenv('HTTP_REFERER'); $title = get_permalink(url_to_postid($permalink)); date_default_timezone_set('America/New_York'); $F9Date = date("Y-m-d") . "-" . date("H:i"); $newphone = preg_replace('/^1|\D/', '', rgar($entry, '3')); $cleanPOST = array( 'first_name' => sanitize_text_field(rgar($entry, '1.3')), 'last_name' => sanitize_text_field(rgar($entry, '1.6')), 'number1' => $newphone, 'F9domain' => $F9domain, 'F9list' => $F9list, 'salesforce_id' => $Campaign_ID, 'Device_6' => $title, 'WebDialer_Key' => $F9Date, 'F9key' => WebDialer_Key, 'F9CallASAP' => true ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://api.five9.com/web2campaign/AddToList"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($cleanPOST)); $response = curl_exec($ch); if (curl_errno($ch)) { $error_msg = curl_error($ch); } curl_close($ch); } session_start(); # Imports all Composer packages require __DIR__ . '/vendor/autoload.php'; use ofc\Site; # Declare a new Site object $site = new Site(); # Allow the Site object to be accessed in other files function site() { global $site; return $site; } /** * Register Custom Navigation Walker */ add_action('after_setup_theme', function () { require_once get_template_directory() . '/bootstrap_5_wp_nav_menu_walker.php'; }); register_nav_menu('consumer-menu', 'Consumer menu'); register_nav_menu('business-menu', 'Buisness menu'); register_nav_menu('col-one-consumer-menu', 'Col 1 Consumer Menu'); register_nav_menu('col-two-consumer-menu', 'Col 2 Consumer Menu'); register_nav_menu('col-three-consumer-menu', 'Col 3 Consumer Menu'); register_nav_menu('col-four-consumer-menu', 'Col 4 Consumer Menu'); register_nav_menu('col-one-business-menu', 'Col 1 Business Menu'); register_nav_menu('col-two-business-menu', 'Col 2 Business Menu'); register_nav_menu('col-three-business-menu', 'Col 3 Business Menu'); register_nav_menu('col-four-business-menu', 'Col 4 Business Menu'); /** * Adds selected style sheet option as a class on body element */ add_filter('body_class', function ($class) { $style_sheet = get_field('style_sheet'); // default to consumer brand if we don't have the ACF option for the current page if (!$style_sheet) { $style_sheet = "consumer-brand"; } $class[] = $style_sheet; return $class; }); /** * Creates a custom excerpt from an ACF post object */ function custom_excerpt($str, $length = 70, $append = '...') { $pieces = explode(' ', strip_tags($str)); $excerpt = implode(' ', array_slice($pieces, 0, $length)); if (count($pieces) > $length) { $excerpt .= $append; } return $excerpt; } /** * Replaces post excerpt truncate and sets as a link */ function wpdocs_excerpt_more( $more ) { if ( ! is_single() ) { $more = sprintf( '%2$s', get_permalink( get_the_ID() ), __( ' Read more >>', 'textdomain' ) ); } return $more; } add_filter( 'excerpt_more', 'wpdocs_excerpt_more' ); function update_individual_fields_11($entry, $form) { echo ''; echo ''; $aarpval = rgpost('input_3', true); $aarp_val = str_replace(' ', '', $aarpval); return $aarp_val; global $aarp_val; } // AARP API add_filter('gform_get_form_filter', 'shortcode_unautop', 11); add_filter('gform_get_form_filter', 'do_shortcode', 11); add_action('gform_pre_submission_7', 'aarp_api'); function aarp_api() { $app_id = 'prodAppId'; $app_secret = 'prodSecret@123'; $aarpval = rgpost('input_3', true); $aarp_val = str_replace(' ', '', $aarpval); $apiUrl = 'https://selfserviceportal.lifeline.com/api/address/v1/affiliates/verify?externalIdType1=memberId&externalIdValue1=' . $aarp_val .'&affiliate=AARP'; $request = wp_remote_get($apiUrl, array('timeout' => 10, 'sslverify' => false, 'headers' => array('appId' => $app_id, 'appSecret' => $app_secret, 'Content-Type' => 'application/json'))); $body = wp_remote_retrieve_body($request); $result = json_decode($body, true); $memberstatus = $result["status"]; if ($memberstatus == "ACTIVE") { add_shortcode('aarpCode', 'aarp_form'); $aarp_coupon = "E6Y8"; $_SESSION['SSESSmember']=$aarp_coupon; } else { add_shortcode('aarpCode', 'aarp_form_notfound'); } } function aarp_form() { $aarp_member .= '
Thank you for providing your Member ID, your discount code will be applied to the your product selection.
Your discount code is:
E6Y8
We could not find the AARP Membership you entered. Please re-type your number and try again. If that does not work, or you need assistance, please call our customer service team: 1-855-345-0130