Created
July 6, 2020 10:57
-
-
Save reachkamrul/5f348c812ab692b7f376c6e1f5eb5b21 to your computer and use it in GitHub Desktop.
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) { | |
if ($form->id != 91) { // Add your form id here | |
return $attachments; | |
} | |
/* | |
* 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