Skip to content

Instantly share code, notes, and snippets.

@techjewel
Created February 6, 2021 10:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techjewel/27137571b5b58f65c3cb98aa6bc87832 to your computer and use it in GitHub Desktop.
Save techjewel/27137571b5b58f65c3cb98aa6bc87832 to your computer and use it in GitHub Desktop.
Create a custom shortcode for email / confirmation or other after form submit
<?php
/*
* Create a custom shortcode for email / confirmation or other after form submit
* Usage: {my_custom_shortcode}
* @param $value string original shortcode string
* @param $parser class \FluentForm\App\Services\FormBuilder\ShortCodeParser
*/
add_filter('fluentform_shortcode_parser_callback_my_custom_shortcode', function ($value, $parser) {
// If you need $submittedData
$entry = $parser::getEntry();
$submittedData = \json_decode($entry->response, true);
// if you need form ID
$formId = $entry->form_id;
return 'my custom value';
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment