Last active
December 31, 2023 15:13
-
-
Save techjewel/1bbb34d258c9ccd8b9d3a51afb9b61f7 to your computer and use it in GitHub Desktop.
Add Attachment to the email notification programatically in Fluent Forms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Add Attachment to the email notification dynamically. | |
* @param $attachments array - Array of the attachments. | |
* @param $notification array - Email Notification array | |
* @param $form object - The Form Object | |
* @param $data array - The input submission data | |
* @return array | |
*/ | |
add_filter('fluentform_filter_email_attachments', function ($attachments, $notification, $form, $data) { | |
/* | |
* You can check if $form or $notification and based on that push your file. | |
*/ | |
$pathToYourFile = WP_CONTENT_DIR.'YOURFILE_PATH/file.pdf'; // Add path to your file | |
$attachments[] = $pathToYourFile; // | |
return $attachments; | |
}, 10, 4); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment