Better Notifications for WordPress - Version 1.6.5

Version Description

  • 18th May 2017 =
  • New: ACF Form compatibility has now been re-added! Props to @elliotcondon for the help.
  • Remember to subscribe to the mailing list if you want to be notified of new add-ons for BNFW and receive 10% off your first add-on purchase.
Download this release

Release Info

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

Code changes from version 1.6.4 to 1.6.5

README.txt CHANGED
@@ -3,8 +3,8 @@ 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: 3.5
6
- Tested up to: 4.7.3
7
- Stable tag: 1.6.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -200,6 +200,10 @@ An older version might work but this is untested. A lot of the newer features re
200
 
201
  == Changelog ==
202
 
 
 
 
 
203
  = 1.6.4 - 18th April 2017 =
204
  * New: You can now use `[global_user_username]` in any notification to output the recipient's username.
205
  * New: When a user is assigned to multiple roles which have been added to a notification, they will only receive the notification once and not once for each role that the notification is configured to send to.
3
  Donate link: https://betternotificationsforwp.com/donate/
4
  Tags: notification, email, push, sms, alert, HTML, customize, bulk, trigger, CC, BCC
5
  Requires at least: 3.5
6
+ Tested up to: 4.7.5
7
+ Stable tag: 1.6.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
200
 
201
  == Changelog ==
202
 
203
+ = 1.6.5 - 18th May 2017 =
204
+ * New: ACF Form compatibility has now been re-added! Props to @elliotcondon for the help.
205
+ * Remember to subscribe to the [mailing list](http://voltronik.us2.list-manage2.com/subscribe?u=57c012217219b2d81dda0085f&id=28eebdab28) if you want to be notified of new add-ons for BNFW and receive 10% off your first add-on purchase.
206
+
207
  = 1.6.4 - 18th April 2017 =
208
  * New: You can now use `[global_user_username]` in any notification to output the recipient's username.
209
  * New: When a user is assigned to multiple roles which have been added to a notification, they will only receive the notification once and not once for each role that the notification is configured to send to.
bnfw.php CHANGED
@@ -3,8 +3,8 @@
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.6.4
7
- * Author: Voltronik
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: hello@betternotificationsforwp.com
10
  * License: GPLv2 or later
@@ -134,6 +134,7 @@ class BNFW {
134
  add_action( 'future_to_publish' , array( $this, 'publish_post' ) );
135
  add_action( 'pending_to_publish' , array( $this, 'publish_post' ) );
136
  add_action( 'private_to_publish' , array( $this, 'publish_post' ) );
 
137
 
138
  add_action( 'publish_to_publish' , array( $this, 'update_post' ) );
139
 
@@ -231,6 +232,16 @@ class BNFW {
231
  $this->publish_post( $post );
232
  }
233
 
 
 
 
 
 
 
 
 
 
 
234
  /**
235
  * Fires when a post is created for the first time.
236
  *
@@ -581,29 +592,45 @@ class BNFW {
581
  *
582
  * @since 1.3.9
583
  *
584
- * @param int $user_id User ID
585
- * @param string $new_role New User role
586
- * @param array $old_role Old User role
587
  */
588
- public function user_role_changed( $user_id, $new_role, $old_role ) {
589
- if ( ! empty( $old_role ) ) {
590
  $notifications = $this->notifier->get_notifications( 'user-role' );
591
  foreach ( $notifications as $notification ) {
592
- $this->engine->send_user_role_changed_email(
593
- $this->notifier->read_settings( $notification->ID ),
594
- $user_id,
595
- $old_role[0],
596
- $new_role
597
- );
 
 
 
 
 
 
 
 
598
  }
599
 
600
  $notifications = $this->notifier->get_notifications( 'admin-role' );
601
  foreach ( $notifications as $notification ) {
602
- $setting = $this->notifier->read_settings( $notification->ID );
603
- $setting['message'] = $this->engine->handle_user_role_shortcodes( $setting['message'], $old_role[0], $new_role );
604
- $setting['subject'] = $this->engine->handle_user_role_shortcodes( $setting['subject'], $old_role[0], $new_role );
605
 
606
- $this->engine->send_notification( $setting , $user_id );
 
 
 
 
 
 
 
 
 
 
 
607
  }
608
  }
609
  }
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.6.5
7
+ * Author: Made with Fuel
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: hello@betternotificationsforwp.com
10
  * License: GPLv2 or later
134
  add_action( 'future_to_publish' , array( $this, 'publish_post' ) );
135
  add_action( 'pending_to_publish' , array( $this, 'publish_post' ) );
136
  add_action( 'private_to_publish' , array( $this, 'publish_post' ) );
137
+ add_action( 'acf/submit_form' , array( $this, 'acf_submit_form' ), 10, 2 );
138
 
139
  add_action( 'publish_to_publish' , array( $this, 'update_post' ) );
140
 
232
  $this->publish_post( $post );
233
  }
234
 
235
+ /**
236
+ * Trigger New Post published notification for ACF forms.
237
+ *
238
+ * @param string $form ACF Form.
239
+ * @param int $post_id Post ID.
240
+ */
241
+ public function acf_submit_form( $form, $post_id ) {
242
+ $this->publish_post( get_post( $post_id ) );
243
+ }
244
+
245
  /**
246
  * Fires when a post is created for the first time.
247
  *
592
  *
593
  * @since 1.3.9
594
  *
595
+ * @param int $user_id User ID
596
+ * @param string $new_role New User role
597
+ * @param array $old_roles Old User role
598
  */
599
+ public function user_role_changed( $user_id, $new_role, $old_roles ) {
600
+ if ( ! empty( $old_roles ) ) {
601
  $notifications = $this->notifier->get_notifications( 'user-role' );
602
  foreach ( $notifications as $notification ) {
603
+
604
+ /**
605
+ * Trigger User Role Changed - For User notification.
606
+ *
607
+ * @since 1.6.5
608
+ */
609
+ if ( apply_filters( 'bnfw_trigger_user-role_notification', true, $notification, $new_role, $old_roles ) ) {
610
+ $this->engine->send_user_role_changed_email(
611
+ $this->notifier->read_settings( $notification->ID ),
612
+ $user_id,
613
+ $old_roles[0],
614
+ $new_role
615
+ );
616
+ }
617
  }
618
 
619
  $notifications = $this->notifier->get_notifications( 'admin-role' );
620
  foreach ( $notifications as $notification ) {
 
 
 
621
 
622
+ /**
623
+ * Trigger User Role Changed - For User notification.
624
+ *
625
+ * @since 1.6.5
626
+ */
627
+ if ( apply_filters( 'bnfw_trigger_admin-role_notification', true, $notification, $new_role, $old_roles ) ) {
628
+ $setting = $this->notifier->read_settings( $notification->ID );
629
+ $setting['message'] = $this->engine->handle_user_role_shortcodes( $setting['message'], $old_roles[0], $new_role );
630
+ $setting['subject'] = $this->engine->handle_user_role_shortcodes( $setting['subject'], $old_roles[0], $new_role );
631
+
632
+ $this->engine->send_notification( $setting, $user_id );
633
+ }
634
  }
635
  }
636
  }
languages/bnfw-de_DE.po CHANGED
@@ -438,8 +438,8 @@ msgstr ""
438
  "Ihre Benutzer versenden."
439
 
440
  #. Author of the plugin/theme
441
- msgid "Voltronik"
442
- msgstr "Voltronik"
443
 
444
  #. Author URI of the plugin/theme
445
  msgid "https://betternotificationsforwp.com/"
438
  "Ihre Benutzer versenden."
439
 
440
  #. Author of the plugin/theme
441
+ msgid "Made with Fuel"
442
+ msgstr "Made with Fuel"
443
 
444
  #. Author URI of the plugin/theme
445
  msgid "https://betternotificationsforwp.com/"
languages/bnfw-fr_FR.po CHANGED
@@ -40,8 +40,8 @@ msgid "Send customisable emails to your users for different WordPress notificati
40
  msgstr "Envoyez des emails personnalisés à vos utilisateurs pour différentes notifications."
41
 
42
  #. Author of the plugin/theme
43
- msgid "Voltronik"
44
- msgstr "Voltronik"
45
 
46
  #. Author URI of the plugin/theme
47
  msgid "https://betternotificationsforwp.com/"
40
  msgstr "Envoyez des emails personnalisés à vos utilisateurs pour différentes notifications."
41
 
42
  #. Author of the plugin/theme
43
+ msgid "Made with Fuel"
44
+ msgstr "Made with Fuel"
45
 
46
  #. Author URI of the plugin/theme
47
  msgid "https://betternotificationsforwp.com/"
languages/bnfw-pt_BR.po CHANGED
@@ -397,8 +397,8 @@ msgid "Send customisable HTML emails to your users for different WordPress notif
397
  msgstr "Enviar emails HTML com notificações personalizáveis para usuários diferentes do WordPress."
398
 
399
  #. Author of the plugin/theme
400
- msgid "Voltronik"
401
- msgstr "Voltronik"
402
 
403
  #. Author URI of the plugin/theme
404
  msgid "https://betternotificationsforwp.com/"
397
  msgstr "Enviar emails HTML com notificações personalizáveis para usuários diferentes do WordPress."
398
 
399
  #. Author of the plugin/theme
400
+ msgid "Made with Fuel"
401
+ msgstr "Made with Fuel"
402
 
403
  #. Author URI of the plugin/theme
404
  msgid "https://betternotificationsforwp.com/"
languages/bnfw.pot CHANGED
@@ -411,7 +411,7 @@ msgid ""
411
  msgstr ""
412
 
413
  #. Author of the plugin/theme
414
- msgid "Voltronik"
415
  msgstr ""
416
 
417
  #. Author URI of the plugin/theme
411
  msgstr ""
412
 
413
  #. Author of the plugin/theme
414
+ msgid "Made with Fuel"
415
  msgstr ""
416
 
417
  #. Author URI of the plugin/theme