PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

gform_user_notification_attachments

  1. Hi there,

    i have insert this piece of code in my functions.php of my theme:

    [php]
    add_filter("gform_user_notification_attachments", "add_attachment", 10, 3);
    function add_attachment($attachments, $lead, $form){
    
        //getting wordpress upload folder
        $upload = wp_upload_dir();
        $upload_path = $upload["basedir"];
    
        $attachments = array();
    
        //add a file from the uploads folder
        $attachments[] = $upload_path . "/Algemene-Voorwaarden-Doxis.pdf";
    
        return $attachments;
    }'

    But the PDF file isn't send with the user notification.. How come??

    Posted 11 years ago on Wednesday August 29, 2012 | Permalink
  2. Can you dump the value of the $attachments array before you return it, to see what it contains? If it does not look correct, work your way backward through the code to see which part is not returning the expected value.

    Also, be sure the file exists and has the proper permissions in the location you are trying to load it from as an email attachment.

    Posted 11 years ago on Wednesday August 29, 2012 | Permalink