I am trying to use gform_after_submission to grab a field value(url of a file) then pass the value to a notification so it can be sent as an attachment. This is what I have so far:
add_action("gform_after_submission", "after_submission", 10, 2);
function after_submission($entry, $form){
$pdf = $entry["3"];
return $pdf;
}
add_filter( 'gform_notification_3', 'add_notification_attachments', 10, 3 );
function add_notification_attachments( $notification, $form, $entry ) {
if ( $notification['name'] == 'Admin Notification' ) {
$path = 'path/to/file.pdf';
$notification['attachments'] = array( $path );
}
return $notification;
}
2
Answers
Thanks Dave, couldn't see your updated code but here's what I managed to do once you told me about converting the URL to a path & it now works perfectly:
Untested but you shouldn’t need the first action, only the notification filter.