<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: PDF attachment for user notification not working</title>
		<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working</link>
		<description>Gravity Support Forums Topic: PDF attachment for user notification not working</description>
		<language>en-US</language>
		<pubDate>Wed, 15 Apr 2026 01:39:36 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/pdf-attachment-for-user-notification-not-working" rel="self" type="application/rss+xml" />

		<item>
			<title>Richard Vav on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-376100</link>
			<pubDate>Fri, 26 Jul 2013 05:13:33 +0000</pubDate>
			<dc:creator>Richard Vav</dc:creator>
			<guid isPermaLink="false">376100@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;If you still require assistance with this please open a new &#60;a href=&#34;http://www.gravityhelp.com/request-support/&#34; rel=&#34;nofollow&#34;&#62;support ticket&#60;/a&#62; or a &#60;a href=&#34;http://www.gravityhelp.com/priority-support/&#34; rel=&#34;nofollow&#34;&#62;priority support ticket&#60;/a&#62; if you are a developer license holder. Thank you.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cslontok on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-356214</link>
			<pubDate>Mon, 01 Jul 2013 17:16:08 +0000</pubDate>
			<dc:creator>cslontok</dc:creator>
			<guid isPermaLink="false">356214@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I'm trying to add images uploaded to a form as attachments to the notification email.  I tried using the code on the Gform_Notification documentation page and I tried the code below from when 1.7 was in beta.  Any help would be appreciated.  The form is on this page:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.scannellproductions.com/employee-tools/promo-sheet/&#34; rel=&#34;nofollow&#34;&#62;http://www.scannellproductions.com/employee-tools/promo-sheet/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;add_filter('gform_notification', 'change_admin_notification_attachments', 10, 3);&#60;br /&#62;
function change_admin_notification_attachments( $notification, $form, $entry ) {&#60;br /&#62;
    if($notification[&#34;name&#34;] == &#34;Admin Notification&#34;){&#60;/p&#62;
&#60;p&#62;        $fileupload_fields = GFCommon::get_fields_by_type($form, array(&#34;fileupload&#34;));&#60;/p&#62;
&#60;p&#62;        if(!is_array($fileupload_fields))&#60;br /&#62;
            return $attachments;&#60;/p&#62;
&#60;p&#62;        $attachments = array();&#60;br /&#62;
        $upload_root = RGFormsModel::get_upload_root();&#60;br /&#62;
        foreach($fileupload_fields as $field){&#60;br /&#62;
            $url = $lead[$field[&#34;id&#34;]];&#60;br /&#62;
            $attachment = preg_replace('&#124;^(.*?)/gravity_forms/&#124;', $upload_root, $url);&#60;br /&#62;
            if($attachment){&#60;br /&#62;
                $attachments[] = $attachment;&#60;br /&#62;
            }&#60;br /&#62;
        }&#60;br /&#62;
        $notification[&#34;attachments&#34;] = $attachments;&#60;br /&#62;
    }&#60;br /&#62;
    return $notification;&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-268043</link>
			<pubDate>Wed, 22 May 2013 09:48:14 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">268043@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You add custom PHP like this to your theme's functions.php file and its placement in that file doesn't matter.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>swbaxter on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-267545</link>
			<pubDate>Wed, 22 May 2013 05:34:43 +0000</pubDate>
			<dc:creator>swbaxter</dc:creator>
			<guid isPermaLink="false">267545@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Dana&#60;/p&#62;
&#60;p&#62;Like Lee, I want to attach a PDF to the notification email but, unlike Lee (I think), I've never done any PHP coding and it scares me to death!&#60;/p&#62;
&#60;p&#62;From your previous answer...&#60;/p&#62;
&#60;p&#62;i) which PHP file do you make these edits to? I saw another post mentioning &#34;common.php&#34; but wanted to confirm this&#60;/p&#62;
&#60;p&#62;ii) can I add my customised version of this code in one block at the bottom of the existing file, or does some of it need to go at the top of the file and some at the bottom?&#60;/p&#62;
&#60;p&#62;Sorry to ask basic PHP questions but I was kind of hoping GF would provide this kind of facility with a nice button!!&#60;/p&#62;
&#60;p&#62;Steve
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Dana Cobb on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-240203</link>
			<pubDate>Mon, 06 May 2013 17:45:00 +0000</pubDate>
			<dc:creator>Dana Cobb</dc:creator>
			<guid isPermaLink="false">240203@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi, Lee,&#60;/p&#62;
&#60;p&#62;Below is an example for attaching a simple text file that resides in the uploads directory using the new hook. Take a look and let us know if you have questions.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;#39;gform_notification_2&#38;#39;, &#38;#39;add_attachment_pdf&#38;#39;, 10, 3); //target form id 2, change to your form id
function add_attachment_pdf( $notification, $form, $entry ) {
    //There is no concept of user notifications anymore, so we will need to target notifications based on other criteria,
    //such as name or subject
    if($notification[&#38;quot;name&#38;quot;] == &#38;quot;User Notification&#38;quot;){
		//get upload root for WordPress
		$upload = wp_upload_dir();
		$upload_path = $upload[&#38;quot;basedir&#38;quot;];

		//add file, use full path , example -- $attachment = &#38;quot;C:\\xampp\\htdocs\\wpdev\\wp-content\\uploads\\test.txt&#38;quot;
		$attachment = $upload_path . &#38;quot;/test.txt&#38;quot;;
        $notification[&#38;quot;attachments&#38;quot;] = $attachment;
    }
	//return altered notification object
    return $notification;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>honeyl on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-235289</link>
			<pubDate>Fri, 03 May 2013 11:35:48 +0000</pubDate>
			<dc:creator>honeyl</dc:creator>
			<guid isPermaLink="false">235289@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Yes, the name of the notification is &#34;User Notification.&#34; The problem I'm having is knowing where to place the name of the file. Do I have that correct in the above example? Everything else is the same as the example you provided except I made the base directory the root of the uploads directory.&#60;/p&#62;
&#60;p&#62;-- Lee
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-235286</link>
			<pubDate>Fri, 03 May 2013 11:32:26 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">235286@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Is the name of the notification you are trying to edit named &#34;User Notification&#34;?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>honeyl on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-234426</link>
			<pubDate>Fri, 03 May 2013 00:11:10 +0000</pubDate>
			<dc:creator>honeyl</dc:creator>
			<guid isPermaLink="false">234426@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Still not working. Here's what I have. What could be hanging this up?&#60;/p&#62;
&#60;p&#62;-- Lee&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//Adds PDF attachment to User Notification
add_filter(&#38;#39;gform_notification_2&#38;#39;, &#38;#39;change_user_notification_attachments&#38;#39;, 10, 3);
function change_user_notification_attachments( $notification, $form, $entry ) {

    //There is no concept of user notifications anymore, so we will need to target notifications based on other criteria, such as name or subject
    if($notification[&#38;quot;name&#38;quot;] == &#38;quot;User Notification&#38;quot;){

        $fileupload_fields = GFCommon::get_fields_by_type($form, array(&#38;quot;fileupload&#38;quot;));

        if(!is_array($fileupload_fields))
            return $attachments;

        $attachments = array();
        $upload_root = RGFormsModel::get_upload_root();
        foreach($fileupload_fields as $field){
            $url = $entry[$field[&#38;quot;id&#38;quot;]];
            $attachment = preg_replace(&#38;#39;&#124;^(.*?)/&#124;&#38;#39;, $upload_root, $url);
            if($attachment){
                $attachments[] = $attachment;
            }
        }

        $notification[&#38;quot;choosing-a-motorcycle-tour.pdf&#38;quot;] = $attachments;

    }

    return $notification;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>David Peralty on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-234206</link>
			<pubDate>Thu, 02 May 2013 20:23:12 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">234206@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;You put change_user_notification_attachments_2 it should be change_user_notification_attachments&#60;/p&#62;
&#60;p&#62;And to specific the form it should be: gform_notification_2&#60;/p&#62;
&#60;p&#62;Hope that helps.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>honeyl on "PDF attachment for user notification not working"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/pdf-attachment-for-user-notification-not-working#post-234195</link>
			<pubDate>Thu, 02 May 2013 20:09:03 +0000</pubDate>
			<dc:creator>honeyl</dc:creator>
			<guid isPermaLink="false">234195@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Thanks David. So in the example on the page you cited, do you still use the _2 after attachments in the first line to denote form ID, or do you replace the &#34;id&#34; phrase with the actual form ID number (shown in line 16 of the example at the end of the cited page)?&#60;/p&#62;
&#60;p&#62;Here's what I used, and it did not work:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;// Allows Gravity Forms to send a PDF attachment in email
add_filter(&#38;#39;gform_notification&#38;#39;, &#38;#39;change_user_notification_attachments_2&#38;#39;, 10, 3);
function change_user_notification_attachments( $notification, $form, $entry ) {

 //There is no concept of user notifications anymore, so we will need to target notifications based on other criteria, such as name or subject
    if($notification[&#38;quot;name&#38;quot;] == &#38;quot;User Notification&#38;quot;){

        $fileupload_fields = GFCommon::get_fields_by_type($form, array(&#38;quot;fileupload&#38;quot;));

        if(!is_array($fileupload_fields))
            return $attachments;

        $attachments = array();
        $upload_root = RGFormsModel::get_upload_root();
        foreach($fileupload_fields as $field){
            $url = $entry[$field[&#38;quot;id&#38;quot;]];
            $attachment = preg_replace(&#38;#39;&#124;^(.*?)/&#124;&#38;#39;, $upload_root, $url);
            if($attachment){
                $attachments[] = $attachment;
            }
        }

        $notification[&#38;quot;choosing-a-motorcycle-tour.pdf&#38;quot;] = $attachments;

    }

    return $notification;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Thanks for your helpl
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
