Celebrate WordCamp Europe - 30% OFF! Use coupon WC30 - View Details

wsf_action_pdf_filenamePRO

Description

The wsf_action_pdf_filename filter hook can be used to customize the filename of PDF’s generated using the PDF add-on.

The filter applies to PDF’s generated as follows:

Usage

add_filter( 'wsf_action_pdf_filename', 'my_hook_function', 10, 3 );

Parameters

  1. $filename String
    The PDF filename.
  2. $form Form Object
    The form object.
  3. $submit Submit Object
    The submit object.

Example

// Callback function for the wsf_action_pdf_filename filter hook
function my_hook_function( $filename, $form, $submit ) {
    
    // Get the form ID
    $form_id = $form->id;

    // Get the submission ID
    $submit_id = $submit->id;

    // Build a new filename
    $filename = sprintf('example-%u-%u.pdf', $form_id, $submit_id);

    // Return value
    return $filename;
}

// Add a callback function for the wsf_action_pdf_filename filter hook
add_filter( 'wsf_action_pdf_filename', 'my_hook_function', 10, 3 );

 

Source File

This hook can be found in: <plugin root>/ws-form-pdf.php