From dac81521f10ccf2013d3dbc6c7fcbfd8bbe116af Mon Sep 17 00:00:00 2001 From: Timothy Wood Date: Fri, 18 Apr 2014 08:57:53 -0400 Subject: [PATCH] version 1.4, fix no conflict mode in Gravity Forms --- README.md | 12 ++++++++++++ gf-notification-attachment.php | 20 ++++++++++++++++++-- readme.txt | 13 +++++++++++-- 3 files changed, 41 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 02ecd62..5e1e6ea 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,19 @@ An active form with notifications must be available to In order to add attachme Note: When WP_DEBUG is active the script will use the unminified version of the script. +### Credits: + +Thanks to the following users for making the plugin better! + +* @saxonycreative +* @mathijsbok + ### Changelog: +#### = 1.4 = + +* fixed Gravity Forms from being greedy to remove the js script for plugin no conflict mode (thanks to @saxonycreative) +* tested compatible to WordPress v3.9 + #### = 1.3 = * fixed filter handling for no attachment emails (thanks to @mathijsbok) diff --git a/gf-notification-attachment.php b/gf-notification-attachment.php index 3ac8bbf..8634131 100644 --- a/gf-notification-attachment.php +++ b/gf-notification-attachment.php @@ -4,7 +4,7 @@ Plugin Name: Gravity Forms: Notification Attachments Plugin URI: http://codearachnid.github.io/gf-notification-attachment/ Description: An addon for Gravity Forms to add attachments to notification emails -Version: 1.3 +Version: 1.4 Author: Timothy Wood (@codearachnid) Author URI: http://codearachnid.com Text Domain: gf_notification_attachment @@ -14,11 +14,13 @@ global $gf_notification_attachment; add_action( 'init', 'gf_notification_attachment_init' ); -add_action( 'wp_ajax_gf_notification_attachment', 'gf_notification_attachment_ajax' ); +add_filter('gform_noconflict_scripts', 'gf_notification_attachment_gform_noconflict' ); add_filter( 'gform_notification', 'gf_notification_attachment_send', 20, 3 ); add_filter( 'gform_pre_notification_save', 'gf_notification_attachment_save', 20, 2 ); add_filter( 'gform_notification_ui_settings', 'gf_notification_attachment_editor', 20, 3 ); add_action( 'admin_enqueue_scripts', 'gf_notification_attachment_attach_script'); +add_action( 'wp_ajax_gf_notification_attachment', 'gf_notification_attachment_ajax' ); + /** * [gf_notification_attachment_init description] @@ -162,3 +164,17 @@ function gf_notification_attachment_attach_script(){ wp_enqueue_style( $plugin->text_domain, $plugin->plugin_url . 'style.css', array(), $plugin->version ); } } + +/** + * [gf_notification_attachment_gform_noconflict description] + * prevent Gravity Forms from being greedy to remove our scripts in no conflict mode + * + * @return array + */ +function gf_notification_attachment_gform_noconflict($allowed_script_keys){ + global $gf_notification_attachment; + $plugin = $gf_notification_attachment; + $allowed_script_keys[] = $plugin->text_domain; + return $allowed_script_keys; +} + diff --git a/readme.txt b/readme.txt index dd8c0de..7150ff0 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: codearachnid Tags: gravityforms, forms, attachment, email, notification Donate link: http://example.com/ Requires at least: 3.7 -Tested up to: 3.8 -Stable tag: 1.3 +Tested up to: 3.9 +Stable tag: 1.4 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -17,6 +17,11 @@ An active form with notifications must be available to In order to add attachme This plugin is [actively maintained on GitHub](http://codearachnid.github.io/gf-notification-attachment/). I welcome your pull requests, comments and suggestions for improvement +Thanks to the following users for making the plugin better! + +* @saxonycreative +* @mathijsbok + == Installation == Installing the plugin is easy. Just follow these steps: @@ -36,6 +41,10 @@ When WP_DEBUG is active the script will use the unminified version of the script 1. The plugin adds logic to the notification edit screen. == Changelog == += 1.4 = +* fixed Gravity Forms from being greedy to remove the js script for plugin in no conflict mode (thanks to @saxonycreative) +* tested compatible to WordPress v3.9 + = 1.3 = * fixed filter handling for no attachment emails (thanks to @mathijsbok)