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:
- The Gravity PDF section of the Gravity Forms System Status page, under
Forms -> System Status - The WordPress Site Health screen, under
Tools -> Site Health - 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 hook | Replacement | What changes |
|---|---|---|
gfpdfe_template_location | gfpdf_template_location | Same 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_uri | gfpdf_template_location_uri | Same arguments ($url, $working_folder, $upload_url). Point it at the same folder as gfpdf_template_location. |
gfpdfe_pdf_name | gfpdf_pdf_filename | The 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_filename | gfpdf_pdf_filename | Same 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_template | gfpdf_pdf_config | Set $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_template | gfpdf_pdf_html_output | You 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_class | gfpdf_mpdf_class | The 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_render | gfpdf_mpdf_class | All three of the v3 mPDF hooks fire at the same point today, so a single gfpdf_mpdf_class callback covers them. |
gfpdfe_pre_render_pdf | gfpdf_mpdf_class | As above – one gfpdf_mpdf_class callback replaces all three. |
gfpdfe_lead_id | gfpdf_template_args | The $lead_id variable it changed only exists in v3 templates. Templates read the entry from $entry now, so change $data['entry'] instead. |
gfpdfe_signature_width | gfpdf_signature_width | Same arguments ($optimised_width, $original_width), both in pixels. Return the width the signature image should be. |
gfpdf_orientation | gfpdf_pdf_config | Set $settings['orientation'] to portrait or landscape. |
gfpdf_security | gfpdf_pdf_config | Set $settings['security'] to Yes or No. The v3 hook accepted true and false as well, and this one doesn't. |
gfpdf_privilages | gfpdf_pdf_config | Set $settings['privileges'] – note the corrected spelling – to an array of privileges: copy, print, print-highres, modify, annot-forms, fill-forms, extract and assemble. |
gfpdf_password | gfpdf_pdf_config | Set $settings['password']. It's only applied when $settings['security'] is Yes and the Format is Standard. Merge tags are supported. |
gfpdf_master_password | gfpdf_pdf_config | Set $settings['master_password'], as shown in the filter's documentation. The same conditions as the password apply. |
gfpdf_rtl | gfpdf_pdf_config | Set $settings['rtl'] to Yes or No. The v3 hook accepted true and false as well, and this one doesn't. |
gfpdf_legacy_save_path | None | It fires only in the v3 download URL and template layers, both of which are removed in 7.0. |
gfpdf_legacy_templates | None | It fires only in the v3 download URL and template layers, both of which are removed in 7.0. |
gfpdf_legacy_pre_view_or_download_pdf | None | It 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_type | None | The 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_template | None | It 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.