Summary
When a Pro Form contains multiple signature fields, using the :url modifier (e.g., {{signature_1:url}} and {{signature_2:url}}) returns the same URL for all signature fields. This causes issues when generating PDFs or emails where each signature should display its own distinct image.
Environment
- Bricksforge Version: 3.1.7.1
- Bricks Version: 2.1.4
- WordPress Version: 6.9
- PHP Version: 8.3
Steps to Reproduce
- Create a Pro Form with two or more signature fields (e.g.,
signature_clientandsignature_coach). - Add a “Create PDF” action to the form.
- In the PDF HTML template, reference each signature using the
:urlmodifier:<p>Client Signature:<br> <img src="{{signature_client:url}}" style="max-width: 200px;"> </p> <p>Coach Signature:<br> <img src="{{signature_coach:url}}" style="max-width: 200px;"> </p> - Submit the form with different signatures in each field.
- View the generated PDF.
Expected Behavior
Each signature field should display its own unique image in the PDF.
Actual Behavior
Both (or all) signature fields display the same image—whichever signature was processed last.
Note: {{all_fields}} correctly displays all signatures as distinct images (because it uses inline base64 data URIs). The bug only affects the :url modifier path.
Root Cause
In includes/elements/pro-forms/actions/base.php, the handle_base64_string() method generates the filename using only time():
// Line ~1529
$file_name = 'signature-' . time() . '.png';
When multiple signature fields are processed in the same form submission (within the same second), they all receive the same filename. Each subsequent signature overwrites the previous file on disk, so all {{signature_x:url}} references point to the same (last-written) image.
Suggested Fix
Replace the filename generation with something that produces a unique name per signature:
$file_name = uniqid( 'signature-', true ) . '.png';
This ensures each signature gets a distinct filename even when processed within the same second.
Workaround
Until fixed, users can:
- Use
{{all_fields}}in PDF templates (which uses inline base64 and works correctly)