Hello @lukiano880
Hope you’re doing well today!
Small note, it seems like some part of my reply got anchored due to some glitch I believe, request you to please ignore the anchor.
Just following up about the issue, I have an update from our developer team regarding the issue. The filter you’re using in the Snippet that you’ve shared does not exists on the plugin’s code. However, you can remove the existing code and replace that with the below snippet.
<?php
add_filter( 'forminator_replace_form_data', 'wpmudev_download_file_message_link', 10, 3 );
function wpmudev_download_file_message_link( $content, $data, $original_content ) {
if ( 30 !== intval( $data['form_id'] ) ) { // Please change the form ID.
return $content;
}
if ( strpos( $content, '{download_link}' ) !== false ) {
$content = str_replace( '{download_link}', '<a href="your_file_path" download>Download</a>', $content );
}
return $content;
}
Please follow the instructions below to add the snippet:
You can add the above snippet as a mu-plugin, for this, you can navigate to the /wp-content/mu-plugins/ directory and create a new PHP file. For example, forminator-download-message.php and paste the above snippet to the file and proceed with the below steps.
Update Form ID:
On the line?
if ( 30 !== intval( $data['form_id'] ) ) { // Please change the form ID.
Please replace the 30 with your Form ID, a form ID is the number that you see on the form shortcode. For example, if [forminator_form id=”30″] is the shortcode, 30 will be the form ID.
Update the path of the file that you want the users to be able to download:
On the line
$content = str_replace( '{download_link}', '<a href="your_file_path" download>Download</a>', $content );
You will need to replace the “your_file_path” with the actual path of the file that you want the users to download. For example: “https://yourwebsite.com/wp-content/uploads/2024/05/example-file.pdf”
Add Macro to the submission message:
Lastly, you will need to add {download_link} macro to the submission message which will render the “Download” link (Ref: https://monosnap.com/file/VEzNrfApkTyvDg99170OmksRAm9GEr)
Hope this helps. Please let us know in case you have any questions/queries about this issue.
Kind Regards,
Saurabh