Skip to main content

Replace Deprecated Actions and Filters

Introduction

When an action or filter in Gravity PDF is superseded we mark it deprecated and continue using it for at least one major version. This gives you time to update any custom code before it's removed. If your code listens to a deprecated hook, it will stop working in a future Gravity PDF release.

How to Tell if You're Affected

Gravity PDF only reports a deprecated hook when something is listening to it (via add_action() or add_filter()). It's reported in three places in your WordPress admin:

  1. The Gravity PDF section of the Gravity Forms System Status page, under Forms -> System Status
  2. The WordPress Site Health screen, under Tools -> Site Health
  3. A dismissible notice on admin screens

Gravity PDF also writes a warning to the log file, and raises a PHP deprecation notice.

Hooks Removed in Gravity PDF 7.0

These hooks are removed in Gravity PDF 7.0, and anything listening to them will stop working. The last column covers what changes when you move across, since some of the replacements aren't a straight swap.

Most of the v3 hooks that changed a single PDF setting are now handled by gfpdf_pdf_config, which filters the whole settings array when a PDF's configuration is loaded. It's passed $settings and the form ID, but not the entry, so anything that varies per entry needs a different hook.

Deprecated hookReplacementWhat changes
gfpdfe_template_locationgfpdf_template_locationSame arguments ($directory, $working_folder, $upload_path). Pair it with gfpdf_template_location_uri and point both at the same folder, which needs to be publicly accessible and writable.
gfpdfe_template_location_urigfpdf_template_location_uriSame arguments ($url, $working_folder, $upload_url). Point it at the same folder as gfpdf_template_location.
gfpdfe_pdf_namegfpdf_pdf_filenameThe v3 hook changed the filename setting before merge tags were processed, while this one runs after. Build the name from $entry rather than returning a merge tag, and leave off the .pdf extension. To change the stored setting instead, set $settings['filename'] through gfpdf_pdf_config.
gfpdfe_pdf_filenamegfpdf_pdf_filenameSame arguments ($name, $form, $entry, $settings). Merge tags have already been processed by this point, so build the name from $entry, and leave off the .pdf extension.
gfpdfe_templategfpdf_pdf_configSet $settings['template'] to the template's file name without the .php extension, like zadani. Use gfpdf_pdf_config_$form_id to target a single form.
gfpdfe_pdf_templategfpdf_pdf_html_outputYou still get the PDF's HTML as a string, but the $form and $entry arrays are passed instead of their IDs, along with the Helper_PDF object. gfpdf_pdf_html_output_$form_id replaces gfpdfe_pdf_template_$form_id.
gfpdfe_mpdf_classgfpdf_mpdf_classThe arguments are $mpdf, $form, $entry, $settings and the Helper_PDF object: full arrays instead of the form and entry IDs, and the filename comes from $Helper_PDF->get_filename().
gfpdfe_mpdf_class_pre_rendergfpdf_mpdf_classAll three of the v3 mPDF hooks fire at the same point today, so a single gfpdf_mpdf_class callback covers them.
gfpdfe_pre_render_pdfgfpdf_mpdf_classAs above – one gfpdf_mpdf_class callback replaces all three.
gfpdfe_lead_idgfpdf_template_argsThe $lead_id variable it changed only exists in v3 templates. Templates read the entry from $entry now, so change $data['entry'] instead.
gfpdfe_signature_widthgfpdf_signature_widthSame arguments ($optimised_width, $original_width), both in pixels. Return the width the signature image should be.
gfpdf_orientationgfpdf_pdf_configSet $settings['orientation'] to portrait or landscape.
gfpdf_securitygfpdf_pdf_configSet $settings['security'] to Yes or No. The v3 hook accepted true and false as well, and this one doesn't.
gfpdf_privilagesgfpdf_pdf_configSet $settings['privileges'] – note the corrected spelling – to an array of privileges: copy, print, print-highres, modify, annot-forms, fill-forms, extract and assemble.
gfpdf_passwordgfpdf_pdf_configSet $settings['password']. It's only applied when $settings['security'] is Yes and the Format is Standard. Merge tags are supported.
gfpdf_master_passwordgfpdf_pdf_configSet $settings['master_password'], as shown in the filter's documentation. The same conditions as the password apply.
gfpdf_rtlgfpdf_pdf_configSet $settings['rtl'] to Yes or No. The v3 hook accepted true and false as well, and this one doesn't.
gfpdf_legacy_save_pathNoneIt fires only in the v3 download URL and template layers, both of which are removed in 7.0.
gfpdf_legacy_templatesNoneIt fires only in the v3 download URL and template layers, both of which are removed in 7.0.
gfpdf_legacy_pre_view_or_download_pdfNoneIt fires only in the v3 download URL and template layers, both of which are removed in 7.0. Once your links use the current endpoint, gfpdf_pre_view_or_download_pdf runs in its place.
gfpdfe_pdf_output_typeNoneThe link now decides whether the PDF displays or downloads, through the shortcode's type attribute or the merge tag's download modifier.
gfpdfe_pre_load_templateNoneIt was how the Business Plus / Tier 2 add-on took over PDF generation. That add-on is no longer supported, and the legacy templates guide covers the upgrade path.

Help and Support

If you rely on a hook with no replacement, get in touch before you update. Knowing what's still in use helps us decide which replacements to build.