I have two forms, the first form on submit it redirects you to the second form. I am using gform_webhooks_request_data to run a function. When the first form submits, the function runs as expected, you’re redirected to the second form. When you submit the second form, this function does not run and I do not know why.
Here is the function that is in functions.php:
add_filter( 'gform_webhooks_request_data', 'hcii_modify_data', 10, 4 );
function hcii_modify_data( $request_data, $feed, $entry, $form ){
// LOGGING
GFCommon::log_debug( __METHOD__ . "(): This is the start of the function." );
if (class_exists('GPDFAPI')) {
$pdf_id = '64adccbdf3fc3';
$entry_id = rgar( $entry, 'id' );
$pdf_path = GPDFAPI::create_pdf( $entry_id, $pdf_id );
if ( !is_wp_error( $pdf_path ) && is_file( $pdf_path ) ) {
$pdfFileContents = file_get_contents( $pdf_path );
$pdfEncoded = base64_encode( $pdfFileContents );
// Delete PDF from temp path
unlink( $pdf_path );
// LOGGING
GFCommon::log_debug( __METHOD__ . "(): This is the encoded PDF: {$pdfEncoded} event." );
}
}
$request_data['Document'] = $pdfEncoded;
return $request_data;
When the function runs on the first form, I get the logged messages. When the second form is submitted, none of the statements log which leads me to believe for some reason the function is not running when the second form is submitted.
Any thoughts?