-
-
Save Stoltze/bf86ff1d485a2c6e6afb26562957fee8 to your computer and use it in GitHub Desktop.
Wordpress plugin that fixes an issue with WP Better Emails not being able to format Gravity Forms email notifications.
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 | |
/** | |
* Plugin Name: Gravity Forms - WPBE Email Fix | |
* Plugin URI: https://chooserethink.com | |
* Description: Fixes an issue with WP Better Emails not being able to format Gravity Forms email notifications. | |
* Version: 1.0.0 | |
* Author: Brianna Deleasa | |
* Author URI: http://chooserethink.com | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt | |
* Text Domain: gravityforms-wpbe-fix | |
* Domain Path: /languages | |
*/ | |
add_filter( 'gform_notification', 'gravityforms_wpbe_gform_notification', 10, 3); | |
/** | |
* Changes the Gravity Forms notification emails from HTML to plain text. | |
* | |
* @param $notification | |
* @param $form | |
* @param $entry | |
* @return mixed | |
*/ | |
function gravityforms_wpbe_gform_notification( $notification, $form, $entry ) { | |
// is_plugin_active is not availble on front end | |
if( ! is_admin() ) | |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
// Check if WPBE is installed and activated | |
if( ! is_plugin_active('wp-better-emails/wpbe.php') ) | |
return $notification; | |
// change notification format to text from the default html | |
$notification['message_format'] = "text"; | |
// disable auto formatting so you don't get double line breaks | |
$notification['disableAutoformat'] = true; | |
return $notification; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment