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.

Attachment on Confirmation Email for Specific Form

  1. Referencing this thread: http://www.gravityhelp.com/forums/topic/use-pre-selected-file-as-user-notification-attachment

    And this code specifically:

    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 . "/my_file.jpg";
    
        return $attachments;
    }

    This function is working properly, but I need to specify the attachment is only attached to confirmations for a single form. How can I do that?

    Posted 11 years ago on Tuesday January 8, 2013 | Permalink
  2. On line one, add the form number to the end of your filter. For example, if you want to add the attachments only to submissions for form 17, line 01 should look like this:

    [php]
    add_filter("gform_user_notification_attachments_17", "add_attachment", 10, 3);

    If you want to target form 5, use this:

    [php]
    add_filter("gform_user_notification_attachments_5", "add_attachment", 10, 3);

    The filter is documented here:
    http://www.gravityhelp.com/documentation/page/Gform_user_notification_attachments

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  3. Brilliant. Thanks yet again, Chris.

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink
  4. You're welcome. Good luck.

    Posted 11 years ago on Wednesday January 9, 2013 | Permalink

This topic has been resolved and has been closed to new replies.