-
-
Save kjohnson/50c55745fd63bdbf21fc to your computer and use it in GitHub Desktop.
<?php | |
/* | |
Plugin Name: Ninja Forms Email Attachment | |
*/ | |
function add_my_attachment( $attachments ) { | |
$attachments[] = 'server_path_to_my_file'; | |
return $attachments; | |
} | |
add_filter( 'nf_email_notification_attachments' , 'add_my_attachment' ); |
I as well have this working and I as well only want it sent to the person who filled out the form, not the site admin.
Hi i came across this issue and even it's from november 2019 maybe i can help some other people.
First, it's my first time that i'am using Ninja Forms. I always use Gravity Form more Developer friendly i think but it's no free plugin.
I had the same problem, two e-mail actions one for the site-owner and the other for the user/subscriber
It is not difficult to exclude the site-owner e-mail.
In this (ninja_forms_action_email_attachments) hook and it's method takes three parameters.
The $setting parameter is an array with values for the form, use that to write a conditional and thats it.
Below a piece of code to get the idea. It's based on the action label in this case the email-type action.
if ($data['form_id'] == 3 ) {
if ( $settings['type'] == 'email' && $settings['label'] != 'Admin email' ) {
$attachments = array( WP_CONTENT_DIR . '/uploads/blablabla.pdf');
return $attachments;
}
}
Just also wanted to mention to others who my enqire, to get the post_id for the submission, it's stored under $data['actions']['save']['sub_id']
(but you need to have "store submission" enabled)
Has there been an answer to the above questions, or is this just not possible?