Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/hooks/filters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
31 changes: 30 additions & 1 deletion src/hooks/filters/pdf.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PDF Filters

<Badge type="tip" vertical="top" text="Filter Hooks" /> <Badge type="tip" vertical="top" text="Add-on" /> <Badge type="warning" vertical="top" text="6 Filters" />
<Badge type="tip" vertical="top" text="Filter Hooks" /> <Badge type="tip" vertical="top" text="Add-on" /> <Badge type="warning" vertical="top" text="7 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`.

Expand Down Expand Up @@ -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).

</explain-block>

<explain-block title="fluentform/pdf_public_download_ttl">

Set a maximum age, in **seconds**, for a **public** PDF download link (the link produced by the `{pdf.download_link.<feed_id>.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()

</explain-block>