<?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: Notification Attachments for Multiple Forms</title>
		<link>https://legacy.forums.gravityhelp.com/topic/notification-attachments-for-multiple-forms</link>
		<description>Gravity Support Forums Topic: Notification Attachments for Multiple Forms</description>
		<language>en-US</language>
		<pubDate>Sun, 19 Apr 2026 23:22:57 +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/notification-attachments-for-multiple-forms" rel="self" type="application/rss+xml" />

		<item>
			<title>Rob Harrell on "Notification Attachments for Multiple Forms"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/notification-attachments-for-multiple-forms#post-72237</link>
			<pubDate>Thu, 23 Aug 2012 08:44:32 +0000</pubDate>
			<dc:creator>Rob Harrell</dc:creator>
			<guid isPermaLink="false">72237@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Nice, thanks for the update - glad you got it working!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Suzanne on "Notification Attachments for Multiple Forms"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/notification-attachments-for-multiple-forms#post-72190</link>
			<pubDate>Wed, 22 Aug 2012 19:36:26 +0000</pubDate>
			<dc:creator>Suzanne</dc:creator>
			<guid isPermaLink="false">72190@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Okay... I solved this... the problem *is* with the $form variable. It's not actually passing a literal form ID. It's passing an array. Either of my solutions above will work (for those interested) but instead of using $form in your comparison operations, you have to use $form['id'] like this:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;if ( $form[ &#38;#39;id&#38;#39; ] == 1 ) {
  $doc = &#38;#39;/2012/08/doc1.pdf&#38;#39;;
}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Suzanne on "Notification Attachments for Multiple Forms"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/notification-attachments-for-multiple-forms#post-72188</link>
			<pubDate>Wed, 22 Aug 2012 19:21:35 +0000</pubDate>
			<dc:creator>Suzanne</dc:creator>
			<guid isPermaLink="false">72188@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I also just tried an if/elseif/else scenario and it fails as well... I get the emails, but no attachments. Hard-code the document to the $attachments[]= line and I get the email AND attachment so the problem is occurring when attempting to handle the $form value. Do you know exactly how that value is being passed? or if it even is? I'm half inclined to believe we're getting an empty variable there.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_user_notification_attachments&#38;quot;, &#38;quot;add_attachment&#38;quot;, 10, 3);
function add_attachment($attachments, $lead, $form) {

    if($form==1) {
        $doc = &#38;#39;/2012/08/doc1.pdf&#38;#39;;
    } elseif($form==2) {
        $doc = &#38;#39;/2012/08/doc2.pdf&#38;#39;;
    } elseif($form==3) {
        $doc = &#38;#39;/2012/08/doc3.pdf&#38;#39;;
    } else {
      $doc = &#38;#39;&#38;#39;;
    }

    $upload = wp_upload_dir();
    $upload_path = $upload[&#38;quot;basedir&#38;quot;];

    $attachments = array();
    $attachments[] = $upload_path . $doc;

    return $attachments;

}&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>Suzanne on "Notification Attachments for Multiple Forms"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/notification-attachments-for-multiple-forms#post-72181</link>
			<pubDate>Wed, 22 Aug 2012 17:39:37 +0000</pubDate>
			<dc:creator>Suzanne</dc:creator>
			<guid isPermaLink="false">72181@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi David, yes I originally had it set up without quotes but that didn't even send the email. I tried all three scenarios: no quotes, single quotes and double quotes. This was the result for each:&#60;/p&#62;
&#60;p&#62;• no quotes = no email&#60;/p&#62;
&#60;p&#62;• single quotes = no email&#60;/p&#62;
&#60;p&#62;• double quotes = email but no attachment
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Peralty on "Notification Attachments for Multiple Forms"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/notification-attachments-for-multiple-forms#post-72081</link>
			<pubDate>Wed, 22 Aug 2012 10:03:44 +0000</pubDate>
			<dc:creator>David Peralty</dc:creator>
			<guid isPermaLink="false">72081@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Have you tried it without the quotation marks around the switch numbers?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Suzanne on "Notification Attachments for Multiple Forms"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/notification-attachments-for-multiple-forms#post-72043</link>
			<pubDate>Wed, 22 Aug 2012 03:20:27 +0000</pubDate>
			<dc:creator>Suzanne</dc:creator>
			<guid isPermaLink="false">72043@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I have a client who, for his own reasons, wants multiple forms, each one sending a different document to the user who provides and email address. I found the gform_user_notification_attachments action and got that to work just fine for ALL form submissions, but obviously in this case, I need to send a different document depending on which form was submitted. So I modified the suggested code to switch the form ID - far more efficient and tidy than any other way - but for some reason it's not sending the document. &#60;/p&#62;
&#60;p&#62;I do get the user notification. Yes. If I hard code one of the documents on the line that reads  $attachments[] = $upload_path . $doc;  for example,  $attachments[] = $upload_path . &#34;doc1.pdf&#34;;  then yes I will get that document, but as it stands below, it's not working. The only thing I can think of is that $form is in a format other than simple ID numbers?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;add_filter(&#38;quot;gform_user_notification_attachments&#38;quot;, &#38;quot;add_attachment&#38;quot;, 10, 3);
function add_attachment($attachments, $lead, $form) {

    switch($form) {
      case &#38;quot;1&#38;quot;:
        $doc = &#38;quot;/2012/08/document_1_for_form_1.pdf&#38;quot;;
        break;
      case &#38;quot;2&#38;quot;:
        $doc = &#38;quot;/2012/08/document_2_for_form_2.pdf&#38;quot;;
        break;
    }

    $upload = wp_upload_dir();
    $upload_path = $upload[&#38;quot;basedir&#38;quot;];

    $attachments = array();
    $attachments[] = $upload_path . $doc;

    return $attachments;

}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;When I switch the form ID, am I doing that right? I'm assuming that the function is receiving  the form ID in the variable $form but maybe I've got the data format wrong?&#60;/p&#62;
&#60;p&#62;Any help getting this working would be great. Thanks
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
