gform_notification_events

Description

Use this filter to add a new event to the drop down of available triggers for notifications. Additional code is necessary to handle the event since this hook only adds it to the Event drop down on the notifications admin page.

Usage

add_filter( 'gform_notification_events', 'add_event' );

Parameters

  • $notification_events array

    An array of notification events.

$notification_events = array( 'form_submission' => esc_html__( 'Form is submitted', 'gravityforms' ) );
if ( rgars( $form, 'save/enabled' ) ) {
$notification_events['form_saved']                = esc_html__( 'Form is saved', 'gravityforms' );
$notification_events['form_save_email_requested'] = esc_html__( 'Save and continue email is requested', 'gravityforms' );
}
  • $form Form Object

    The current Form object.

  • Examples

    1. User Registered Event

    This example adds the trigger “User is registered” to the Event drop down on the Notifications page.

    add_filter( 'gform_notification_events', 'add_event' );
    function add_event( $notification_events ) {
    $notification_events['user_registered'] = __( 'User is registered', 'gravityforms' );
    return $notification_events;
    }
    

    2. Manual Notification Event

    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.

    add_filter( 'gform_notification_events', 'gw_add_manual_notification_event' );
    function gw_add_manual_notification_event( $events ) {
    $events['manual'] = __( 'Send Manually' );
    return $events;
    }
    

    3. Payment Notification Events

    See the Send Notifications On Payment Events article for code snippets for sending notifications when various payment related events occur.

    4. Mailchimp API failed Notification Event

    This example adds the trigger “Mailchimp API Issue” to the Event drop down on the Notifications page for use in combination with the Mailchimp API Issue custom action example. You can adapt this example for use with any other Add-On Framework based add-on.

    add_filter( 'gform_notification_events', function ( $events ) {
    $events['mailchimp_api_issue'] = 'Mailchimp API Issue';
    
    return $events;
    } );
    

    Placement

    This code should be placed in the functions.php file of your active theme.

    Source Code

    This action hook is located in GFNotification::get_notification_events() in notification.php