Skip to content

Instantly share code, notes, and snippets.

@New0
Last active April 22, 2024 16:32
Show Gist options
  • Save New0/f818e97d200b69a5db107d865d2a9c15 to your computer and use it in GitHub Desktop.
Save New0/f818e97d200b69a5db107d865d2a9c15 to your computer and use it in GitHub Desktop.
Example usage of a Ninja Forms Zapier add-on filter hook for field data sent to Zapier. This can be installed as a plugin using the Download ZIP feature of this Gist interface and the Upload ZIP method in WP. This requires a precise version of the Zapier add-on. Contact Ninja Forms support if you are not sure to have the correct version.
<?php
/*
Plugin Name: Ninja Forms Custom Zapier Data
Description: Testing Ninja Forms hook
Version: 1.0.0
*/
/**
* Filter a value recorded for Zapier data. To be used with Ninja Forms Zapier >= 3.1.0
*
* THIS EXAMPLE is using "listselect_1713786441727" as the field key which value we want to filter. That needs to be adapted to the key of the precise field used in a form.
*
* @param string Value of the field. Can change depending on field type but it was already formatted for Zapier's usage.
* @param array field data
*/
add_filter('nf_zapier_filter_field_value', function ($value, $field) {
if ($field['key'] === "listselect_1713786441727") {
$value = "/gs_paises(fhyjtyjtjtyjytj-tyjtyjjty0000-08888)";
}
return $value;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment