Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save spivurno/49d0aef7e41f38cb53ec3f90f20cb6c3 to your computer and use it in GitHub Desktop.
Save spivurno/49d0aef7e41f38cb53ec3f90f20cb6c3 to your computer and use it in GitHub Desktop.
<?php
/**
* Gravity Wiz // Gravity Forms // Email Header to Identify Notification Source
*
* You've installed Gravity Forms on a ton of sites and now you're getting a ton of notifications. The problem is there
* is no clear indicator which site is sending the notification. How frustrating!
*
* This simple plugin automatically adds a custom header that identifies the URL that generated the Gravity Forms notification.
* This is most useful when installed as an MU plugin at the start of development on each site.
*
* @version 1.0
* @author David Smith <[email protected]>
* @license GPL-2.0+
* @link http://gravitywiz.com/
*
* Plugin Name: Gravity Forms - Email Header: Notification Source
* Plugin URI: http://gravitywiz.com/
* Description: Add a custom email header to identify the URL that generated the Gravity Forms notification.
* Author: Gravity Wiz
* Version: 1.0
* Author URI: http://gravitywiz.com
*/
add_filter( 'gform_pre_send_email', function( $email ) {
$email['headers']['X-gravity-forms-source'] = sprintf( 'X-gravity-forms-source: %s', GFFormsModel::get_current_page_url() );
return $email;
} );
@spivurno
Copy link
Author

spivurno commented Oct 27, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment