ericakfranz
4/7/2015 - 8:08 PM

gistfile1.php

<?php
add_filter( 'optin_monster_pre_optin_mailchimp', 'tgm_om_custom_mailchimp_data', 10, 4 );
/**
 * Filter the data sent to Mailchimp.
 *
 * See here for more info on what is passed: https://apidocs.mailchimp.com/api/2.0/lists/subscribe.php
 *
 * @param array $data     Array of data being sent to Mailchimp.
 * @param array $lead     Array of lead data captured from the optin submission.
 * @param string $list_id The unique list ID to subscribe the lead to.
 * @param object $api     The Mailchimp API connection object.
 */
function tgm_om_custom_mailchimp_data( $data, $lead, $list_id, $api ) {
	
	// Pass the IP address to Mailchimp as well.
	$data['optin_ip'] = $_SERVER['REMOTE_ADDR'];
	
	// Ensure to return the data after it has been modified.
	return $data;
	
}