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.

Add field descriptions in notification e-mail

  1. maelle
    Member

    Hi,
    I would like to add field descriptions in notification e-mails to users. I have checked the notification.php file but I could not find where to edit that.
    Can you please help?

    If this is not possible, what I need to do is sending some information on the notification e-mail based upon the last two checkbox fields. Example: if you decide to do A, then text A is sent to the user who submit the form, if you decide to do B, then text B is sent.
    Description seemed the best way to achieve it but if you think of another way to solve my issue, I would be glad to have your tips.

    Thank you very much,
    Maëlle

    Posted 10 years ago on Monday October 10, 2011 | Permalink
  2. Don't modify any core Gravity Forms files.

    I did something similar to this once:
    http://gravity.chrishajer.com/request-a-brochure/

    Your notification email, if you test submit that form (which is safe for you to do) will contain links to just the documents referenced in the checkboxes. So, you could have any combination of those last three checkboxes modify your notification email.

    The code for that is here:
    http://pastebin.com/Sb8PSPyX

    It uses the gform_pre_submission_filter to change the notification before it's sent.

    Posted 10 years ago on Tuesday October 11, 2011 | Permalink
  3. maelle
    Member

    Thanks for your answer! I tried to adapt your code and this issue to mine so I added the first part of the code (customizing it) in my theme functions.php and the rest in form_display.php.
    I am having some error messages after I submit the form:
    Warning: Invalid argument supplied for foreach() in /.../wp-content/plugins/gravityforms/common.php
    Where could I have gone wrong?

    Maëlle

    Posted 10 years ago on Wednesday October 12, 2011 | Permalink
  4. You should not modify form_display.php at all. I can't tell you if your modifications there are causing the problems or not.

    Please post the whole error message (all the error messages) so we can see the line numbers.

    Also, this is a warning, not a fatal error. It will not stop the processing of your form. The display of the warning is more annoying than anything else and can be suppressed on a production site.

    Posted 10 years ago on Wednesday October 12, 2011 | Permalink
  5. maelle
    Member

    Here are the error message lines: http://pastebin.com/DDUXPRjV
    Also here is the code I wrote in functions.php: http://pastebin.com/1FhGiXgr

    Thanks for your patience!

    Posted 10 years ago on Wednesday October 12, 2011 | Permalink
  6. Since you edited core Gravity Forms files I would suggest re-installing the Gravity Forms files from scratch and rolling back and custom changes you hade made.

    Posted 10 years ago on Wednesday October 12, 2011 | Permalink
  7. maelle
    Member

    My Gravity Forms configuration is back to normal but now I do not know where to edit this Gform pre submission filter. Can you tell me where to customize the filters as described in http://www.gravityhelp.com/documentation/page/Gform_pre_submission_filter ?
    Thanks!

    Posted 10 years ago on Tuesday October 25, 2011 | Permalink
  8. Any code using the gform_pre_submission filter will be added to your theme's functions.php file.

    In this code:
    http://pastebin.com/1FhGiXgr

    The closing brace needs to be on line 14, not line 4. You are closing the function before it does anything, and the rest of the code is just hanging out there.

    Posted 10 years ago on Tuesday October 25, 2011 | Permalink
  9. maelle
    Member

    Thanks Chris. Do I need to add something in the e-mail notification message in the Edit Forms section? The filter does not work despite the code added (correctly with closing braces at the right place) in my theme's functions.php file.

    Posted 10 years ago on Tuesday October 25, 2011 | Permalink
  10. The notification is being added to by the code in functions.php. If there is nothing in the email notification in the form builder, then the only thing in the notification will be what you have in functions.php.

    Please post again exactly what you are trying to accomplish, and what code you have added to your theme's functions.php. Thank you.

    Posted 10 years ago on Wednesday October 26, 2011 | Permalink
  11. maelle
    Member

    Chris,
    Here is the notification email in which I would like to add the 48.1 and 49.1 field descriptions (after Payment method): http://pastebin.com/bxczLLRE and here is the code that was originally in my notification email: http://pastebin.com/EQTVGWws
    I tried to replace "message 1" and "message 2" by the entire http://pastebin.com/EQTVGWws message but it would not work: I cannot activate notification emails to users and leave a blank message and when I deactivate notification emails to users then no email is sent.

    Posted 10 years ago on Friday October 28, 2011 | Permalink
  12. maelle
    Member

    My problem has not been solved yet... does anybody have an answer?
    Thank your very much!

    Posted 9 years ago on Thursday November 3, 2011 | Permalink
  13. Maëlle, in this notification http://pastebin.com/bxczLLRE - what do you want to add? A description should be added to the two payment method lines there? Can you tell me what you're trying to add, or show a link to your form. I don't think I have the whole picture yet.

    In the code examples I posted, the notification from the form builder was being added to, at the end. It sounds like you want to add something in the middle of this notification? If so, what is that?

    Thank you.

    Posted 9 years ago on Friday November 4, 2011 | Permalink
  14. maelle
    Member

    Chris, this is a registration form : users who submit the form choose at the very end the payment method they will use to confirm registration as there is no online payment.
    I have therefore a thank you message with a summary of the main form fields (originally inserted with merge tags) and at the end a cutomized message with payment details according to their choices.
    I actually changed my settings with radio buttons instead of multiple checkboxes in order to prevent users from ticking both boxes and I removed the field descriptions. My code inserted in functions.php is now http://pastebin.com/KpUmPGWT.
    I also read yesterday in this topic in which you set up your Request a Brochure test form (http://www.gravityhelp.com/forums/topic/conditional-logic-for-user-notifications - how come I did not find it before!!!) that I needed to leave a blank line in the message field. I did that and it worked, I also disabled auto-formatting and I kept your <p> html tags but I must have missed something in my html settings as user notifications are now blank, just as they are in the notification section so the code inserted in functions.php does not override it.

    I hope this is clearer and you can help finalize that very last trick!

    Posted 9 years ago on Friday November 4, 2011 | Permalink