Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    • Documentation
    • Support
    • Account

Send Manual Notifications with Gravity Forms

Email users who have submitted your forms whenever you need to; not just when the form is submitted.

Last updated May 28, 2020 | Written by David Smith 34 Comments

  • August 7, 2015 Fixed issue where anonymous functions were causing fatal errors for older versions of PHP.

  • May 8, 2015 Added support for notification conditional logic on "manual" notifications. Thanks, hannanstd.

Show CodeDownload Code
<?php
/**
* Gravity Wiz // Gravity Forms // Send Manual Notifications
*
* Provides a custom notification event that allows you to create notifications that can be sent
* manually (via Gravity Forms "Resend Notifications" feature).
*
* @version 1.2
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
* @link http://gravitywiz.com/send-manual-notifications-with-gravity-forms/
*/
class GW_Manual_Notifications {
private static $instance = null;
public static function get_instance() {
if( null == self::$instance )
self::$instance = new self;
return self::$instance;
}
private function __construct() {
add_filter( 'gform_notification_events', array( $this, 'add_manual_notification_event' ) );
add_filter( 'gform_before_resend_notifications', array( $this, 'add_notification_filter' ) );
}
public function add_notification_filter( $form ) {
add_filter( 'gform_notification', array( $this, 'evaluate_notification_conditional_logic' ), 10, 3 );
return $form;
}
public function add_manual_notification_event( $events ) {
$events['manual'] = __( 'Send Manually' );
return $events;
}
public function evaluate_notification_conditional_logic( $notification, $form, $entry ) {
// if it fails conditional logic, suppress it
if( $notification['event'] == 'manual' && ! GFCommon::evaluate_conditional_logic( rgar( $notification, 'conditionalLogic' ), $form, $entry ) ) {
add_filter( 'gform_pre_send_email', array( $this, 'abort_next_notification' ) );
}
return $notification;
}
public function abort_next_notification( $args ) {
remove_filter( 'gform_pre_send_email', array( $this, 'abort_next_notification' ) );
$args['abort_email'] = true;
return $args;
}
}
function gw_manual_notifications() {
return GW_Manual_Notifications::get_instance();
}
gw_manual_notifications();
view raw gw-gravity-forms-manual-notifications.php hosted with ❤ by GitHub

This simple snippet allows you to send notifications manually to users who have submitted your forms and provided an email.

  • Email all users who submitted the form
    Example: provide updates to users who signed up for your event
  • Email any user who selected a specific value
    Example: notify users that the option they selected for a product is no longer available
If you’re looking for an even faster way to email all users who have submitted a form, check out GP Email Users.

Getting Started

1. Install Snippet

The snippet will add support for the “Send Manually” notification event. By default there is only one notification event so Gravity Forms does not show the setting on the Notification edit screen; however, if you have more than one Notification Event, Gravity Forms will display the “Event” setting.

  1. Make sure Gravity Forms is installed and active.
    Need a license? Buy Gravity Forms
  2. Copy and paste the entire snippet into your theme’s functions.php file.
    Having trouble installing the snippet?.
  3. No code configuration required.

2. Create a New Notification

gw-manual-notifications-notification-event-setting
  1. Select “Send Manually” from the list of Notification Events
  2. Configure the notification as you would any other notification

3. Send Manual Notification

We will use Gravity Forms’ Resend Notifications feature to send our manual notification.

  1. gw-manual-notifications-entries
    Go to the Entry List page.
  2. gw-manual-notifications-entries-select-all
    Check the checkbox next to each entry to which you would like to resend the notification.
  3. gw-manual-notifications-entries-bulk-action-resend-notifications
    Select “Resend Notifications” from the Bulk Actions drop down.
  4. gw-manual-notifications-entries-resend-notifications-modal
    All of your notifications will appear; select your manual notification from the list.
  5. gw-manual-notifications-entries-resend-notifications
    Click the “Resend Notifications” button to send your manual notification.

More Examples

Send notifications for specific entries

Follow the steps above.

Send notifications for all entries with a specific option selected

There are two ways to accomplish this. You can add the conditional logic to the notification itself – or – you can filter the entries displayed in the Entry List view and only send to the filtered list.

Which is better? I prefer filtering from the Entry List view. It’s more flexible and allows you to more easily reuse the same manual notifications (when it makes sense).

  1. gw-manual-notifications-entries
    Go to the Entry List page.
  2. gw-manual-notifications-entries-filter
    Use the entry filter to narrow down the list of entries based on your criteria.
  3. gw-manual-notifications-entries-select-all-filtered
    Select all of the filtered entries.
  4. Follow the instructions above (starting from step #3) to send your manual notification to the selected entries.

With that said, if you find you need more complex filtering, the conditional logic setting on the notification will allow you to apply multiple filters which may be required for your use case.

Was this helpful?

We’d really love to hear how you use this functionality. Seriously, I’m not just saying that. Let us know in the comments!

Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 32+ essential add-ons for Gravity Forms with support you can count on.

  • View All Perks
  • Buy Gravity Perks

Filed Under: Tutorials

Comments

  1. jasim says

    May 28, 2020 at 2:45 am

    is it possible to re send emails based on another form submission results i have 2 form One for registration and the other one for survey i want to re send the emails those who registered and didn’t submit the survey form

    is this possible?

    Reply
    • Ryan Donovan says

      May 28, 2020 at 10:11 am

      Hello Jasim, something like this would require a certain flow to check and see if one form has been submitted and another has not been. I would check out the GravityFlow plugin and see if this is something that would work for your needs.

  2. arvind says

    April 27, 2020 at 1:37 pm

    Hi there

    Thanks for this awesome snippet. This works well

    The email users perk however may not be sending emails to unique values – instead it may be sending an email to every entry of that form without filtering out duplicate email ids – which may be the result of duplicate submissions over a long period of time. Have sent a line to support

    Thanks

    Reply
    • arvind says

      April 27, 2020 at 1:40 pm

      Just one more thing I added some email ids to the black list but email users perk may not be considering those and still sending them Thanks

    • arvind says

      April 27, 2020 at 1:41 pm

      Thanks for all your awesome perks though

  3. Christiaan says

    May 2, 2019 at 9:01 am

    Thanks for this snippet! It is simple and effective!

    Reply
    • David Smith says

      May 2, 2019 at 9:15 am

      Glad you found it useful!

  4. Sam says

    October 15, 2018 at 9:43 pm

    This is a great snippet that can be added to perform alot of custom functionality. I am just curious, why when you abort the notification, do you have to remove the filter before passing the ? remove_filter( ‘gform_pre_send_email’, array( $this, ‘abort_next_notification’ ) ); Why not just send the arg and finished? What is the point of removing the filter? Thanks.

    Reply
    • David Smith says

      October 16, 2018 at 7:54 am

      Hi Sam, the issue is that we only want to abort the very next notification not all subsequent notifications.

  5. Ambuj says

    September 9, 2018 at 2:01 am

    Hi David – Thanks for these wonderful Gravity Form snippets. I am developing a social cum profit online start up to help needy patients get medical services at affordable rates. I have a setup where medical service providers can fill out Gravity Forms to list their services on my site (with annual subscription of 365 days post submission of the form), and I want them to be sent automatic email notifications as payment reminders on the expiry of their subscription period.

    I have tried using these 2 snippets of yours (populate end date field to 1 year from current date, and send manual notifications with gravity forms – both snippets work independently) to implement this automatic email notification feature based on conditional logic in notifications settings (to check if populated end date is equal to the current date). However, in the form notification settings –> conditional logic, I can’t see the option to select the populated end date field 1 year, is there a snippet to make it show up or any other workaround for solving this issue. Any help will be much appreciated. Thanks again.

    regards, Ambuj

    Reply
  6. Carrie Smaha says

    May 24, 2018 at 3:50 pm

    Is this snippet still supported? Is the 2015 code compliant with 2018 standards and Gravity Form updates?

    Reply
    • David Smith says

      May 25, 2018 at 4:43 am

      Hi Carrie, it is mostly likely still working. Very few snippets actually broke with the major GF 2.3 release. Let us know if you encounter any issue. :)

  7. Joe says

    September 9, 2016 at 10:38 am

    Would this or something else you know of allow an automatic email to be sent at a later date based on a user selected date?

    Reply
    • David Smith says

      September 10, 2016 at 9:03 am

      I do not know of a solution that will allow you to automatically send a notification at a later date.

  8. James Dunn says

    March 18, 2016 at 11:21 am

    Hey David.

    This is “almost” exactly what I was looking for and I think I can make it work by just building the conditional logic the way I need it to make it work. But, I was looking for a way to send an email to a specific individual that has submitted an entry to a form (assuming you’ve gotten their email address).

    Any thoughts on this? I was thinking I had seen a plugin to do that, but I think it must have been this tutorial that I had seen.

    Reply
    • David Smith says

      March 18, 2016 at 12:31 pm

      Hi James, you search for the individual on the Entry List view, you can select the entry and “resend” the manual notification to only that entry (individual).

    • James Dunn says

      March 18, 2016 at 11:58 pm

      I think you misunderstood what I wanted. I don’t want to resend the notification – I want to send a custom email to just that person. For example, I goofed and required the registrants for a golf tournament to select whether they wanted a mens or ladies golf shirt – conditional logic then shows the list of mens sizes or ladies sizes depending upon their answer. However, in my haste, I forgot to ALSO make that field “required”, so about half the registrants didn’t bother to select a size after they chose mens or ladies. I was wanting to go through each of those entries and send those people an email asking them for their shirt size.

    • David Smith says

      March 19, 2016 at 12:23 pm

      Hi James, this functionality is based on the idea of using Gravity Forms’ resend notifications feature. When you create a manual notification, you aren’t actually resending it, you’re just using the resent feature to send it when you want.

      In your case, you need to find the entries that correspond to the orders with missing information. You can then “resend” (aka send for the first time) the manual notification you’ve created that addresses the missing information.

    • James Dunn says

      March 20, 2016 at 5:14 pm

      Now I got it David. Thanks for the heads up…that’s actually so simple that I missed it. LOL

  9. Ed Nailor says

    March 1, 2016 at 3:11 pm

    I would like to be able to do this from the front side. Say a client is coming back to my site, and I have the entry ID for their submission. I would like to have a button for them to click, or to automatically send upon page load, to get a copy of the notification.

    Can this be modified to do this?

    Reply
    • David Smith says

      March 8, 2016 at 12:16 pm

      This can be done but it would require custom code. If you’re interested in commissioning this functionality, feel free to get in touch.

  10. Volatil says

    November 5, 2015 at 7:42 am

    Hi, David!

    I really appreciate your work, so keep doing it – I think that is very helpful for all of us and it it’s worth it.

    I am wondering if there is a snippet or kind of workaround to send a different notification or confirmation after a ceratin number of entries. There is an option to limit the entries but after that the form is inactive. I want my form to remain active but the notification and confirmation text to be different. Is there any code for that option so far?

    Thanks!

    Reply
    • David Smith says

      November 22, 2015 at 6:10 pm

      Hi Volatil, I don’t have a ready solution for this one. The basic idea is that you need some custom conditional logic that does an entry count and then compares it to your threshold. If you’re interested in commissioning this functionality, get in touch.

  11. Cesar says

    October 24, 2015 at 6:28 am

    Hi David, i’ve copied the entire snippet but I get this error:

    “Fatal error: Call to undefined function add_filter() in …/wp-includes/functions.php on line 645”

    Line 645: add_filter( ‘gform_notification_events’, array( $this, ‘add_manual_notification_event’ ) );

    What can I do? Thanks!

    Reply
    • David Smith says

      October 24, 2015 at 1:15 pm

      Hi Cesar, make sure you’re adding this to your theme’s functions.php file and not the /wp-includes/functions.php file. The path will be something like: /wp-content/themes//functions.php

  12. Giacomo says

    September 16, 2015 at 5:36 am

    Hi David, i’d like to drip the automatic email notification on gravity form. it’s possibile? For example to set a notification after 24 hours, or 2 day by submitted form There is a way?

    Reply
    • David Smith says

      September 19, 2015 at 7:31 pm

      I believe this add-on will accomplish what you need: http://codecanyon.net/item/gravity-forms-simple-drip-autoresponder-addon-/6114252

  13. dm says

    August 5, 2015 at 11:03 am

    I am trying to use the Send Manual Notifications with Gravity Forms

    When I place the snippet in the functions php file I get Parse error: syntax error, unexpected T_FUNCTION in /home/goodwork/public_html/registration/wp-content/themes/gwn/functions.php on line 614

    The code at 614 is add_filter( ‘gform_before_resend_notifications’, function( $form ) { any help would be appreciated. Thx

    Reply
    • David Smith says

      August 7, 2015 at 9:27 am

      Hi Darren, I’ve updated the snippet to no longer use anonymous functions. You’re probably running an older version of PHP where they are not supported. You can get the latest version above.

  14. hannanstd says

    May 6, 2015 at 8:54 pm

    hi . how can we limit this to send base on notifictions conditional logic?

    Reply
    • David Smith says

      May 6, 2015 at 9:06 pm

      Yep, this automatically works with the notifications conditional logic.

    • hannanstd says

      May 8, 2015 at 5:05 am

      hi . it not working with conditional logic and send emails to all entries. i write a snippets to work with conditional logic. pastebin.com/mJ9bTb5F

    • David Smith says

      May 8, 2015 at 8:50 pm

      You were right, hannanstd. This was not working with the notification conditional logic. I’ve added support for this based on your code. Thanks!

Trackbacks

  1. gform_notification_events – Gravity Forms Documentation says:
    October 5, 2017 at 4:48 pm

    […] This example (by Gravity Wiz) adds the “Send Manually” notification event. This can be used in combination with the Resend Notifications feature to manually email users have submitted your form on demand. Read the full tutorial for details. […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • How To (64)
  • News (21)
  • Plugins (14)
  • Releases (7)
  • Resource (3)
  • Snippets (58)
  • Tutorials (57)
  • Updates (104)

Recent Posts

  • How to Send a Follow-Up and Pre-Fill Information
  • How to Update Posts with Gravity Forms
  • Gravity Wiz Weekly #104
  • The Complete Guide to Using Gravity Forms With Zapier
  • Gravity Wiz Weekly #103

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2021 · Powered by WordPress · Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Gravity Perks
    ▼
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    ▼
    • Documentation
    • Support
    • Account