diff --git a/src/hooks/filters/index.md b/src/hooks/filters/index.md index 2938c95..e0146f3 100644 --- a/src/hooks/filters/index.md +++ b/src/hooks/filters/index.md @@ -19,6 +19,7 @@ Fluent Forms provides filter hooks that let you modify data and behavior. Filter | [User Registration](./user-registration/) | 10 | Modify user registration fields and roles | | [Webhook](./webhook/) | 5 | Modify webhook request arguments | | [Payment](./payment/) | 55 | Modify payment processing and gateway settings | +| [PDF](./pdf/) | 7 | Control PDF add-on behaviour (public download links) | ## Quick Example diff --git a/src/hooks/filters/pdf.md b/src/hooks/filters/pdf.md index 5dee50c..b0129ed 100644 --- a/src/hooks/filters/pdf.md +++ b/src/hooks/filters/pdf.md @@ -1,6 +1,6 @@ # PDF Filters - + Filters exposed by the **Fluent Forms PDF** add-on (`fluentforms-pdf`). Use these to customize mPDF configuration, the PDF body / CSS, template list, and watermark behavior. Source repo: `fluentforms-pdf`. @@ -153,3 +153,32 @@ add_filter('fluentform/pdf_watermark_image_size', function ($value) { This filter is located in `fluentforms-pdf/Modules/FluentForms/Templates/TemplateManager.php` (line 182). + + + +Set a maximum age, in **seconds**, for a **public** PDF download link (the link produced by the `{pdf.download_link..public}` smartcode and served by the unauthenticated `downloadPublic` endpoint). + +By default the value is `0`, which means **no expiry** — public links do not expire, preserving links already sent in notification emails. Return a positive number of seconds to expire links older than that. Links generated before a TTL was configured carry no timestamp and are never expired. + +**Parameters** + +- `$ttl` (int) Max age in **seconds**; `0` disables expiry (default) +- `$feedId` (int) PDF feed ID +- `$submissionId` (int) Submission ID + +**Usage** + +```php +// Expire public PDF links 30 days after they are generated. +add_filter('fluentform/pdf_public_download_ttl', function ($ttl, $feedId, $submissionId) { + return 30 * DAY_IN_SECONDS; +}, 10, 3); +``` + +**Reference** + +`apply_filters('fluentform/pdf_public_download_ttl', 0, $feedId, $submissionId);` + +This filter is located in `fluentforms-pdf/Modules/FluentForms/FluentFormsIntegration.php` -> downloadPublic() + +