Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cristianuibar/992680ce56b57f92774f0cba161b5c8e to your computer and use it in GitHub Desktop.
Save cristianuibar/992680ce56b57f92774f0cba161b5c8e to your computer and use it in GitHub Desktop.
fluent form trigger integration feed
use FluentForm\App\Modules\Form\FormDataParser;
use FluentForm\App\Modules\Form\FormFieldsParser;
if (isset($_GET['test'])) {
function getEntry($id, $form)
{
$submission = wpFluent()->table('fluentform_submissions')->find($id);
$formInputs = FormFieldsParser::getEntryInputs($form, ['admin_label', 'raw']);
return FormDataParser::parseFormEntry($submission, $form, $formInputs);
}
add_action('fluentform_loaded', function () {
// these are the requirede params
$feedId = 73;
$entryId = 1347;
$formId = 14;
$form = wpFluent()->table('fluentform_forms')
->where('id', $formId)
->first();
$feed = wpFluent()->table('fluentform_form_meta')
->where('form_id', $formId)
->where('id', $feedId)
->first();
if (!$feed) {
return;
}
$entry = getEntry($entryId, $form);
$formData = json_decode($entry->response, true);
$parsedValue = json_decode($feed->value, true);
$processedValues = $parsedValue;
unset($processedValues['conditionals']);
$item = [
'id' => $feed->id,
'meta_key' => $feed->meta_key,
'settings' => $parsedValue,
'processedValues' => $processedValues
];
$action = 'fluentform_integration_notify_' . $item['meta_key'];
do_action($action, $item, $formData, $entry, $form);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment