Better Notifications for WordPress - Version 1.7.2

Version Description

  • 21st November 2018 =
  • Fixed: WYSIWYG editor and meta box compatibility for Gutenberg. After the public release of WordPress 5.0 BNFW will continue to use the Classic Editor, as opposed to the new block editor.
  • Fixed: New Comment Awaiting Moderation notifications weren't being sent to the Post Author, where selected.
Download this release

Release Info

Developer voltronik
Plugin Icon 128x128 Better Notifications for WordPress
Version 1.7.2
Comparing to
See all releases

Code changes from version 1.7.1 to 1.7.2

README.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: voltronik
3
  Donate link: https://betternotificationsforwp.com/donate/
4
  Tags: notification, email, push, sms, alert, HTML, customize, bulk, trigger, CC, BCC
5
  Requires at least: 4.0
6
- Tested up to: 4.9.8
7
  Requires PHP: 5.6
8
- Stable tag: 1.7.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -209,6 +209,10 @@ Yes, of course! The plugin is completely translation-friendly and if you send me
209
 
210
  == Changelog ==
211
 
 
 
 
 
212
  = 1.7.1 - 5th November 2018 =
213
  * New: Full support for the new [Subscriptions (GDPR Compliancy)](https://betternotificationsforwp.com/downloads/subscriptions-gdpr/) add-on.
214
  * Fixed: Comments marked as SPAM were triggering the 'New Comment Awaiting Moderation' notification.
3
  Donate link: https://betternotificationsforwp.com/donate/
4
  Tags: notification, email, push, sms, alert, HTML, customize, bulk, trigger, CC, BCC
5
  Requires at least: 4.0
6
+ Tested up to: 5.0
7
  Requires PHP: 5.6
8
+ Stable tag: 1.7.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
209
 
210
  == Changelog ==
211
 
212
+ = 1.7.2 - 21st November 2018 =
213
+ * Fixed: WYSIWYG editor and meta box compatibility for Gutenberg. After the public release of WordPress 5.0 BNFW will continue to use the Classic Editor, as opposed to the new block editor.
214
+ * Fixed: New Comment Awaiting Moderation notifications weren't being sent to the Post Author, where selected.
215
+
216
  = 1.7.1 - 5th November 2018 =
217
  * New: Full support for the new [Subscriptions (GDPR Compliancy)](https://betternotificationsforwp.com/downloads/subscriptions-gdpr/) add-on.
218
  * Fixed: Comments marked as SPAM were triggering the 'New Comment Awaiting Moderation' notification.
bnfw.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Better Notifications for WordPress
4
  * Plugin URI: https://wordpress.org/plugins/bnfw/
5
  * Description: Supercharge your WordPress notifications using a WYSIWYG editor and shortcodes. Default and new notifications available. Add more power with Add-ons.
6
- * Version: 1.7.1
7
  * Author: Made with Fuel
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: hello@betternotificationsforwp.com
3
  * Plugin Name: Better Notifications for WordPress
4
  * Plugin URI: https://wordpress.org/plugins/bnfw/
5
  * Description: Supercharge your WordPress notifications using a WYSIWYG editor and shortcodes. Default and new notifications available. Add more power with Add-ons.
6
+ * Version: 1.7.2
7
  * Author: Made with Fuel
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: hello@betternotificationsforwp.com
includes/admin/class-bnfw-notification.php CHANGED
@@ -22,6 +22,8 @@ class BNFW_Notification {
22
  add_action( 'edit_form_top', array( $this, 'admin_notices' ) );
23
  add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
24
 
 
 
25
  // Custom row actions.
26
  add_filter( 'post_row_actions', array( $this, 'custom_row_actions' ), 10, 2 );
27
 
@@ -117,11 +119,13 @@ class BNFW_Notification {
117
  */
118
  public function add_meta_boxes() {
119
  add_meta_box(
120
- 'bnfw-post-notification', // Unique ID
121
  esc_html__( 'Notification Settings', 'bnfw' ), // Title
122
  array( $this, 'render_settings_meta_box' ), // Callback function
123
  self::POST_TYPE, // Admin page (or post type)
124
- 'normal' // Context
 
 
125
  );
126
 
127
  add_meta_box(
@@ -130,10 +134,27 @@ class BNFW_Notification {
130
  array( $this, 'render_submitdiv' ),
131
  self::POST_TYPE,
132
  'side',
133
- 'core'
 
134
  );
135
  }
136
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  /**
138
  * Render the settings meta box.
139
  *
22
  add_action( 'edit_form_top', array( $this, 'admin_notices' ) );
23
  add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
24
 
25
+ add_filter( 'use_block_editor_for_post_type', array( $this, 'disable_gutenberg_for_notification' ), 10, 2 );
26
+
27
  // Custom row actions.
28
  add_filter( 'post_row_actions', array( $this, 'custom_row_actions' ), 10, 2 );
29
 
119
  */
120
  public function add_meta_boxes() {
121
  add_meta_box(
122
+ 'bnfw-post-notification', // Unique ID
123
  esc_html__( 'Notification Settings', 'bnfw' ), // Title
124
  array( $this, 'render_settings_meta_box' ), // Callback function
125
  self::POST_TYPE, // Admin page (or post type)
126
+ 'normal', // Context
127
+ 'default',
128
+ array( '__block_editor_compatible_meta_box' => false )
129
  );
130
 
131
  add_meta_box(
134
  array( $this, 'render_submitdiv' ),
135
  self::POST_TYPE,
136
  'side',
137
+ 'core',
138
+ array( '__block_editor_compatible_meta_box' => false )
139
  );
140
  }
141
 
142
+ /**
143
+ * Disable Gutenberg for notifications.
144
+ *
145
+ * @param bool $is_enabled Is Gutenberg enabled?
146
+ * @param string $post_type Post Type.
147
+ *
148
+ * @return bool Should Gutenberg be enabled?
149
+ */
150
+ public function disable_gutenberg_for_notification( $is_enabled, $post_type ) {
151
+ if ( self::POST_TYPE === $post_type ) {
152
+ return false;
153
+ }
154
+
155
+ return $is_enabled;
156
+ }
157
+
158
  /**
159
  * Render the settings meta box.
160
  *
includes/helpers/helpers.php CHANGED
@@ -129,7 +129,7 @@ function bnfw_is_comment_notification( $notification_name ) {
129
 
130
  default:
131
  $type = explode( '-', $notification_name, 2 );
132
- if ( 'comment' == $type[0] ) {
133
  $is_comment_notification = true;
134
  }
135
  break;
129
 
130
  default:
131
  $type = explode( '-', $notification_name, 2 );
132
+ if ( 'comment' == $type[0] || 'moderate' === $type[0] ) {
133
  $is_comment_notification = true;
134
  }
135
  break;
includes/license/class-bnfw-license.php CHANGED
@@ -60,6 +60,38 @@ class BNFW_License {
60
 
61
  // Deactivate license key
62
  add_action( 'admin_init', array( $this, 'deactivate_license' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
 
65
  /**
60
 
61
  // Deactivate license key
62
  add_action( 'admin_init', array( $this, 'deactivate_license' ) );
63
+
64
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'update_plugins_transient_unserialize_icons' ), 99 );
65
+ }
66
+
67
+ /**
68
+ * Filter the transient data for our plugin's icons.
69
+ * Since icons are passed back as serialized arrays, we need to unserialize them.
70
+ * This has to be run from within your plugin.
71
+ *
72
+ * Based on code from https://renventura.com/adding-update-icons-for-commercial-plugins/
73
+ *
74
+ * @param (object) $transient - Full transient data
75
+ *
76
+ * @return mixed (object) $transient
77
+ */
78
+ public function update_plugins_transient_unserialize_icons( $transient ) {
79
+
80
+ if ( is_object( $transient ) && isset( $transient->response ) && is_array( $transient->response ) ) {
81
+
82
+ $basename = plugin_basename( __FILE__ );
83
+
84
+ // Received a response for our plugin
85
+ $plugin = isset( $transient->response[ $basename ] ) ? $transient->response[ $basename ] : new stdClass;
86
+
87
+ // Are there any icons set for the plugin?
88
+ if ( isset( $plugin->icons ) ) {
89
+ $icons = is_string( $plugin->icons ) ? unserialize( $plugin->icons ) : $plugin->icons;
90
+ $transient->response[ $basename ]->icons = $icons;
91
+ }
92
+ }
93
+
94
+ return $transient;
95
  }
96
 
97
  /**