Description
The gform_pre_process_async_notifications
action hook can be used to perform custom actions just before the background processor sends queued notifications.
Usage
The action hook which runs for notifications sent in the background would be used like so:
add_action( 'gform_pre_process_async_notifications', 'your_function_name', 10, 5 );
Parameters
- $event string
The event the notifications are to be sent for. Default isform_submission
. - $notifications array
An array containing the IDs of the notifications to be sent. - $form Form Object
The form currently being processed. - $entry Entry Object
The entry currently being processed. - $data array
An array of data which can be used in the notifications via the generic {object:property} merge tag. Defaults to empty array.
Example
add_action( 'gform_pre_process_async_notifications', function( $event, $notifications, $form, $entry, $data ) {
// Do something before the notifications are sent in the background.
} );
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
This action hook was added in Gravity Forms v2.7.1
Source Code
This action hook is located in \Gravity_Forms\Gravity_Forms\Async\GF_Notifications_Processor::task()
in /includes/async/class-gf-notifications-processor.php.