I am trying to use the attachments feature in the 1.7 beta, but I can't seem to get the notifications to send with the attachments, they just come through as normal E-Mails.. Here is the code from my functions.php:
add_filter('gform_notification', 'change_admin_notification_attachments', 10, 3);
function change_admin_notification_attachments( $notification, $form, $entry ) {
if($notification["name"] == "Admin Notification"){
$fileupload_fields = GFCommon::get_fields_by_type($form, array("fileupload"));
if(!is_array($fileupload_fields))
return $attachments;
$attachments = array();
$upload_root = RGFormsModel::get_upload_root();
foreach($fileupload_fields as $field){
$url = $lead[$field["id"]];
$attachment = preg_replace('|^(.*?)/gravity_forms/|', $upload_root, $url);
if($attachment){
$attachments[] = $attachment;
}
}
$notification["attachments"] = $attachments;
}
return $notification;
}
Any help with this would be much appreciated, I would prefer the attachments instead of a link. Note, I use the WP-Mail-SMTP plugin.
Thanks!