Forked from thomasgriffin/gist:e82ac5bb6d66734b6112
Last active
August 29, 2015 14:18
-
-
Save ericakfranz/31701b04f0cbe92de2a2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment