Closed PthPndr closed 8 years ago
Just hook to ...service_filter_post
to alter mapped values:
class Forms3rdpartyDateFormatting {
const B = 'Forms3rdPartyIntegration';
private $_field; // where to look for the expected field
function __construct() {
// hook even later than xpost so we can manipulate final output
add_filter(self::B.'service_filter_post', array(&$this, 'adjust_format'), 11, 5); // don't actually need all 5, just the $post
$this->_field = 'your-date-field'; // or get from a configurable wp_option?
}
public function adjust_format($post, $service, $form, $sid, $submission) {
$date = $post[$this->_field];
// do your parsing + formatting
$post[$this->_field] = $date;
return $post;
}
}
I ran across this plugin and it is exactly what we're looking for. I was able to setup the services with no issues but am having problems trying to setup a filter. I am not a developer so I am unsure about a lot of this.
We are using Gravity Forms and MailChimp to capture a user's birthday information. The Gravity Forms date format is mm/dd/yyyy and MailChimp wants mm/dd.
I ran across the code below which will do what I want but it is for the MailChimp's add-on for Gravity Forms. Is there a way to repurpose it for forms-3rdparty-integration?
I can either submit mm/dd to MailChimp or I believe I can submit the mm and dd separately. Any help or point in the right direction would be greatly appreciated.