Created
March 8, 2020 17:22
-
-
Save spivurno/49d0aef7e41f38cb53ec3f90f20cb6c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👉 This Gist has been migrated to the Gravity Wiz Snippet Library:
https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-email-header-notification-source.php