gravityflowpdf_file_name

This filter changes the file name on the server and has been deprecated as it would cause possible issues with merge tags and PDF download links. If you were using it prior to deprecation (V1.5) we recommend two potential changes for your code:
  1. To change the filename of PDF which users download from the server
    Use the gravityflowpdf_download_file_name filter. It has the exact same parameter structure and fully supports the {workflow_pdf_download_link} merge tag.
  2. To create a copy of the PDF file on the server
    Use the gravityflowpdf_generated action hook.

Use this filter to change the name of the PDF file generated via the PDF Generator Add-On.

Parameters

$file_name string
The file name

$entry_id integer
The Entry ID

$form_id integer
The Form ID

Example 1

This example adds a prefix to the name of the file.

add_filter( 'gravityflowpdf_file_name', 'sh_gravityflowpdf_file_name', 10, 3 );
function sh_gravityflowpdf_file_name( $file_name, $entry_id, $form_id ) {
	return 'my-pdf-' . $file_name;
}

Example 2

This example adds a prefix of the Step ID to the name of the file for certain steps.

add_filter( 'gravityflowpdf_file_name', 'sh_filename_with_step', 10, 3 );
function sh_filename_with_step( $file_name, $entry_id, $form_id ) {
	$api = new Gravity_Flow_API( $form_id );
	$entry = GFAPI::get_entry( $entry_id );
	$step = $api->get_current_step( $entry );
	if( $step->get_id() == '3' ) {
		$file_name = 'step-' . $step->get_id() . '-' . $file_name;
	}
	return $file_name;
}

Placement

This code should be placed in the functions.php file of your active theme.