Created
February 6, 2021 10:22
-
-
Save techjewel/27137571b5b58f65c3cb98aa6bc87832 to your computer and use it in GitHub Desktop.
Create a custom shortcode for email / confirmation or other after form submit
This file contains 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 | |
/* | |
* 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