Better Notifications for WordPress - Version 1.8.3

Version Description

  • 1st June 2020 =
  • Fixed: If you activate BNFW and have not created any notifications, the default WordPress personal data export and erase request emails did not get sent.
  • Added: Compatibility with the 1.2 release of the Custom Fields add-on.
Download this release

Release Info

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

Code changes from version 1.8.2 to 1.8.3

README.txt CHANGED
@@ -5,7 +5,7 @@ Tags: notification, email, push, sms, alert, HTML, customize, bulk, trigger, CC,
5
  Requires at least: 4.0
6
  Tested up to: 5.4.1
7
  Requires PHP: 5.6
8
- Stable tag: 1.8.2
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -234,6 +234,10 @@ Yes, of course! The plugin is completely translation-friendly and if you send me
234
 
235
  == Changelog ==
236
 
 
 
 
 
237
  = 1.8.2 - 14th May 2020 =
238
  * Fixed: Email addresses stored in custom fields weren't being used in Comment notifications when the Custom Fields add-on was installed.
239
  * Fixed: Two PHP notices showing above the subscriptions form when the Subscriptions add-on was installed.
5
  Requires at least: 4.0
6
  Tested up to: 5.4.1
7
  Requires PHP: 5.6
8
+ Stable tag: 1.8.3
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
234
 
235
  == Changelog ==
236
 
237
+ = 1.8.3 - 1st June 2020 =
238
+ * Fixed: If you activate BNFW and have not created any notifications, the default WordPress personal data export and erase request emails did not get sent.
239
+ * Added: Compatibility with the 1.2 release of the [Custom Fields add-on](https://betternotificationsforwp.com/downloads/custom-fields/).
240
+
241
  = 1.8.2 - 14th May 2020 =
242
  * Fixed: Email addresses stored in custom fields weren't being used in Comment notifications when the Custom Fields add-on was installed.
243
  * Fixed: Two PHP notices showing above the subscriptions form when the Subscriptions add-on was installed.
bnfw.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Better Notifications for WP
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.8.2
7
  * Author: Made with Fuel
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: hello@betternotificationsforwp.com
@@ -1136,19 +1136,24 @@ class BNFW {
1136
  */
1137
  public function handle_user_request_email_content( $content, $email_data ) {
1138
  $field = 'message';
 
1139
 
1140
  switch ( $email_data['description'] ) {
1141
  case 'Export Personal Data':
1142
  $notification_name = 'ca-export-data';
1143
- $content = $this->handle_user_request_notification( $notification_name, $field, $email_data );
1144
  break;
1145
  case 'Erase Personal Data':
1146
  $notification_name = 'ca-erase-data';
1147
- $content = $this->handle_user_request_notification( $notification_name, $field, $email_data );
1148
  break;
1149
  }
1150
-
1151
- return $content;
 
 
 
 
1152
  }
1153
 
1154
  /**
@@ -1162,19 +1167,23 @@ class BNFW {
1162
  */
1163
  public function handle_user_request_email_subject( $subject, $blogname, $email_data ) {
1164
  $field = 'subject';
 
1165
 
1166
  switch ( $email_data['description'] ) {
1167
  case 'Export Personal Data':
1168
  $notification_name = 'ca-export-data';
1169
- $subject = $this->handle_user_request_notification( $notification_name, $field, $email_data );
1170
  break;
1171
  case 'Erase Personal Data':
1172
  $notification_name = 'ca-erase-data';
1173
- $content = $this->handle_user_request_notification( $notification_name, $field, $email_data );
1174
  break;
1175
  }
1176
-
1177
- return $subject;
 
 
 
1178
  }
1179
 
1180
  /**
@@ -1187,19 +1196,24 @@ class BNFW {
1187
  */
1188
  public function handle_user_confirmed_action_email_content( $content, $email_data ) {
1189
  $field = 'message';
 
1190
 
1191
  switch ( $email_data['description'] ) {
1192
  case 'Export Personal Data':
1193
  $notification_name = 'uc-export-data';
1194
- $content = $this->handle_user_confirmed_action_notification( $notification_name, $field, $email_data );
1195
  break;
1196
  case 'Erase Personal Data':
1197
  $notification_name = 'uc-erase-data';
1198
- $content = $this->handle_user_confirmed_action_notification( $notification_name, $field, $email_data );
1199
  break;
1200
  }
1201
 
1202
- return $content;
 
 
 
 
1203
  }
1204
 
1205
  /**
@@ -1213,6 +1227,7 @@ class BNFW {
1213
  public function handle_data_export_email_content( $content, $request_id ) {
1214
  $field = 'message';
1215
  $notification_name = 'data-export';
 
1216
 
1217
  $notifications = $this->notifier->get_notifications( $notification_name );
1218
  if ( count( $notifications ) > 0 ) {
@@ -1220,10 +1235,14 @@ class BNFW {
1220
  // If there are multiple notification then we will read data about only the last one
1221
  $setting = $this->notifier->read_settings( end( $notifications )->ID );
1222
 
1223
- return $this->engine->handle_data_export_email_shortcodes( $setting[ $field ], $setting, $request_id );
1224
  }
1225
 
1226
- return $content;
 
 
 
 
1227
  }
1228
 
1229
  public function handle_erasure_complete_email_subject( $subject, $sitename, $email_data ) {
@@ -1240,17 +1259,19 @@ class BNFW {
1240
 
1241
  protected function handle_erasure_complete_email_notification( $field, $content, $email_data ) {
1242
  $notification_name = 'data-erased';
1243
-
1244
  $notifications = $this->notifier->get_notifications( $notification_name );
1245
  if ( count( $notifications ) > 0 ) {
1246
  // Ideally there should be only one notification for this type.
1247
  // If there are multiple notification then we will read data about only the last one
1248
  $setting = $this->notifier->read_settings( end( $notifications )->ID );
1249
-
1250
- return $this->engine->handle_shortcodes( $setting[ $field ], $notification_name, $email_data );
1251
  }
1252
-
1253
- return $content;
 
 
 
1254
  }
1255
 
1256
  /**
3
  * Plugin Name: Better Notifications for WP
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.8.3
7
  * Author: Made with Fuel
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: hello@betternotificationsforwp.com
1136
  */
1137
  public function handle_user_request_email_content( $content, $email_data ) {
1138
  $field = 'message';
1139
+ $new_content = '';
1140
 
1141
  switch ( $email_data['description'] ) {
1142
  case 'Export Personal Data':
1143
  $notification_name = 'ca-export-data';
1144
+ $new_content = $this->handle_user_request_notification( $notification_name, $field, $email_data );
1145
  break;
1146
  case 'Erase Personal Data':
1147
  $notification_name = 'ca-erase-data';
1148
+ $new_content = $this->handle_user_request_notification( $notification_name, $field, $email_data );
1149
  break;
1150
  }
1151
+
1152
+ if(!empty($new_content)){
1153
+ return $new_content;
1154
+ }else{
1155
+ return $content;
1156
+ }
1157
  }
1158
 
1159
  /**
1167
  */
1168
  public function handle_user_request_email_subject( $subject, $blogname, $email_data ) {
1169
  $field = 'subject';
1170
+ $new_subject = '';
1171
 
1172
  switch ( $email_data['description'] ) {
1173
  case 'Export Personal Data':
1174
  $notification_name = 'ca-export-data';
1175
+ $new_subject = $this->handle_user_request_notification( $notification_name, $field, $email_data );
1176
  break;
1177
  case 'Erase Personal Data':
1178
  $notification_name = 'ca-erase-data';
1179
+ $new_subject = $this->handle_user_request_notification( $notification_name, $field, $email_data );
1180
  break;
1181
  }
1182
+ if(!empty($new_subject)){
1183
+ return $new_subject;
1184
+ }else{
1185
+ return $subject;
1186
+ }
1187
  }
1188
 
1189
  /**
1196
  */
1197
  public function handle_user_confirmed_action_email_content( $content, $email_data ) {
1198
  $field = 'message';
1199
+ $new_content = '';
1200
 
1201
  switch ( $email_data['description'] ) {
1202
  case 'Export Personal Data':
1203
  $notification_name = 'uc-export-data';
1204
+ $new_content = $this->handle_user_confirmed_action_notification( $notification_name, $field, $email_data );
1205
  break;
1206
  case 'Erase Personal Data':
1207
  $notification_name = 'uc-erase-data';
1208
+ $new_content = $this->handle_user_confirmed_action_notification( $notification_name, $field, $email_data );
1209
  break;
1210
  }
1211
 
1212
+ if(!empty($new_content)){
1213
+ return $new_content;
1214
+ }else{
1215
+ return $content;
1216
+ }
1217
  }
1218
 
1219
  /**
1227
  public function handle_data_export_email_content( $content, $request_id ) {
1228
  $field = 'message';
1229
  $notification_name = 'data-export';
1230
+ $new_content = '';
1231
 
1232
  $notifications = $this->notifier->get_notifications( $notification_name );
1233
  if ( count( $notifications ) > 0 ) {
1235
  // If there are multiple notification then we will read data about only the last one
1236
  $setting = $this->notifier->read_settings( end( $notifications )->ID );
1237
 
1238
+ $new_content = $this->engine->handle_data_export_email_shortcodes( $setting[ $field ], $setting, $request_id );
1239
  }
1240
 
1241
+ if(!empty($new_content)){
1242
+ return $new_content;
1243
+ }else{
1244
+ return $content;
1245
+ }
1246
  }
1247
 
1248
  public function handle_erasure_complete_email_subject( $subject, $sitename, $email_data ) {
1259
 
1260
  protected function handle_erasure_complete_email_notification( $field, $content, $email_data ) {
1261
  $notification_name = 'data-erased';
1262
+ $new_content = '';
1263
  $notifications = $this->notifier->get_notifications( $notification_name );
1264
  if ( count( $notifications ) > 0 ) {
1265
  // Ideally there should be only one notification for this type.
1266
  // If there are multiple notification then we will read data about only the last one
1267
  $setting = $this->notifier->read_settings( end( $notifications )->ID );
1268
+ $new_content = $this->engine->handle_shortcodes( $setting[ $field ], $notification_name, $email_data );
 
1269
  }
1270
+ if(!empty($new_content)){
1271
+ return $new_content;
1272
+ }else{
1273
+ return $content;
1274
+ }
1275
  }
1276
 
1277
  /**
includes/admin/class-bnfw-notification.php CHANGED
@@ -516,7 +516,7 @@ foreach ( $taxs as $tax ) {
516
  <tr valign="top" id="post-author">
517
  <th>
518
  <?php esc_html_e( 'Send to Author', 'bnfw' ); ?>
519
- <div class="bnfw-help-tip"><p><?php esc_html_e( 'E.g. If you want a new comment notification to go to the author of the post that was commented on, tick this box.', 'bnfw' ); ?></p></div>
520
  </th>
521
 
522
  <td>
516
  <tr valign="top" id="post-author">
517
  <th>
518
  <?php esc_html_e( 'Send to Author', 'bnfw' ); ?>
519
+ <div class="bnfw-help-tip"><p><?php esc_html_e( 'E.g. If you want a new post published notification to go to the post author, tick this box.', 'bnfw' ); ?></p></div>
520
  </th>
521
 
522
  <td>