Better Notifications for WordPress - Version 1.3.4

Version Description

  • 2nd October 2015 =
  • New: Choose automatic or manual paragraph / line breaks in the WYSIWYG editor. This fixes an issue where they were inserted automatically when they weren't desired. The checkbox for this is below the WYSIWYG editor.
  • New: You can now add images to your notifications using the 'Add Media' button above the WYSIWYG editor.
  • New: Portuguese Brazil translation for v1.3.3 (props Glayton Caixeta).
  • New: BNFW now has it's own website!
  • New: Buttons have been added linking to the Documentation and Shortcode Help sections of the website next to the WYSIWYG editor.
  • New: Support for premium add-ons, coming very soon! More info and sign-up for updates here.
  • New: Added a video overview of BNFW showing it's features and functionality to the main plugin page and website.
  • Fixed: The 'New User Registration - For User' now works again after WordPress 4.3 broke it.
  • Fixed: HTML using quotes was being escaped in emails.
  • Fixed: The 'Settings' sidebar menu item wasn't highlighting properly.
  • I also added all previous release dates to this changelog.
  • If you liked this plugin, please feel free to leave an honest review. If you didn't or have a problem, please send me a message in the Support Forum.
Download this release

Release Info

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

Code changes from version 1.3.5 to 1.3.4

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: voltronik
3
  Tags: notifications, email, mail, alerts, roles, user, users, admin, HTML, plain, wp_mail, shortcode, customize, post, page, updated, pending review, scheduled, category, tag, term, custom post type, comment, akismet, trackback, pingback, lost password, welcome, new user, bulk, notice, trigger, CC, BCC, from, author
4
  Requires at least: 3.5
5
  Tested up to: 4.3.1
6
- Stable tag: 1.3.5
7
  License: GPLv2 or later
8
 
9
  Send customisable emails to your users for different WordPress notifications.
@@ -169,12 +169,6 @@ It might do but this is untested.
169
 
170
  == Changelog ==
171
 
172
- = 1.3.5 - 9th October 2015 =
173
- * Fixed: A large bug that was causing issues with Password URL shortcodes in the 'New User Registration - For User' and 'Password Reset - For User' notifications.
174
- * Fixed: An issue where the 'disabled wpautop' checkbox was appearing on transactional emails.
175
- * Fixed: Some labels in the 'All Notifications' screen weren't formatted correctly.
176
- * Fixed: Translations weren't referenced correctly. Auto-translation will be [done by WordPress.org automatically](https://make.wordpress.org/plugins/2015/09/01/plugin-translations-on-wordpress-org/) at some point in the future.
177
-
178
  = 1.3.4 - 2nd October 2015 =
179
  * New: Choose automatic or manual paragraph / line breaks in the WYSIWYG editor. This fixes an issue where they were inserted automatically when they weren't desired. The checkbox for this is below the WYSIWYG editor.
180
  * New: You can now add images to your notifications using the 'Add Media' button above the WYSIWYG editor.
3
  Tags: notifications, email, mail, alerts, roles, user, users, admin, HTML, plain, wp_mail, shortcode, customize, post, page, updated, pending review, scheduled, category, tag, term, custom post type, comment, akismet, trackback, pingback, lost password, welcome, new user, bulk, notice, trigger, CC, BCC, from, author
4
  Requires at least: 3.5
5
  Tested up to: 4.3.1
6
+ Stable tag: 1.3.4
7
  License: GPLv2 or later
8
 
9
  Send customisable emails to your users for different WordPress notifications.
169
 
170
  == Changelog ==
171
 
 
 
 
 
 
 
172
  = 1.3.4 - 2nd October 2015 =
173
  * New: Choose automatic or manual paragraph / line breaks in the WYSIWYG editor. This fixes an issue where they were inserted automatically when they weren't desired. The checkbox for this is below the WYSIWYG editor.
174
  * New: You can now add images to your notifications using the 'Add Media' button above the WYSIWYG editor.
assets/js/bnfw.js CHANGED
@@ -22,16 +22,16 @@ jQuery(document).ready(function($) {
22
  toggle_fields();
23
 
24
  if ( 'user-password' === $('#notification').val() || 'new-user' === $('#notification').val() || 'welcome-email' === $('#notification').val() || 'reply-comment' === $('#notification').val() ) {
25
- $('#toggle-fields, #email, #cc, #bcc, #users, #email-formatting, #disable-autop, #current-user, #post-author').hide();
26
  $('#user-password-msg').show();
27
  } else if ( 'new-comment' === $('#notification').val() || 'new-trackback' === $('#notification').val() || 'new-pingback' === $('#notification').val() || 'admin-password' === $('#notification').val() || 'admin-user' === $('#notification').val() ) {
28
- $('#toggle-fields, #users, #email-formatting, #disable-autop, #current-user').show();
29
  $('#only-post-author').prop( 'checked', false );
30
  $('#post-author').hide();
31
  toggle_fields();
32
  $('#user-password-msg').hide();
33
  } else {
34
- $('#toggle-fields, #users, #email-formatting, #disable-autop, #current-user, #post-author').show();
35
  toggle_fields();
36
  toggle_users();
37
  $('#user-password-msg').hide();
@@ -42,15 +42,15 @@ jQuery(document).ready(function($) {
42
  $('#notification').on('change', function() {
43
  var $this = $(this);
44
  if ( 'user-password' === $this.val() || 'new-user' === $this.val() || 'welcome-email' === $this.val() || 'reply-comment' === $this.val() ) {
45
- $('#toggle-fields, #email, #cc, #bcc, #users, #email-formatting, #disable-autop, #current-user, #post-author').hide();
46
  $('#user-password-msg').show();
47
  } else if ( 'new-comment' === $('#notification').val() || 'new-trackback' === $('#notification').val() || 'new-pingback' === $('#notification').val() || 'admin-password' === $('#notification').val() || 'admin-user' === $('#notification').val() ) {
48
  $('#post-author').hide();
49
- $('#toggle-fields, #users, #email-formatting, #disable-autop, #current-user').show();
50
  $('#user-password-msg').hide();
51
  toggle_fields();
52
  } else {
53
- $('#toggle-fields, #users, #email-formatting, #disable-autop, #current-user, #post-author').show();
54
  $('#user-password-msg').hide();
55
  toggle_fields();
56
  }
22
  toggle_fields();
23
 
24
  if ( 'user-password' === $('#notification').val() || 'new-user' === $('#notification').val() || 'welcome-email' === $('#notification').val() || 'reply-comment' === $('#notification').val() ) {
25
+ $('#toggle-fields, #email, #cc, #bcc, #users, #email-formatting, #current-user, #post-author').hide();
26
  $('#user-password-msg').show();
27
  } else if ( 'new-comment' === $('#notification').val() || 'new-trackback' === $('#notification').val() || 'new-pingback' === $('#notification').val() || 'admin-password' === $('#notification').val() || 'admin-user' === $('#notification').val() ) {
28
+ $('#toggle-fields, #users, #email-formatting, #current-user').show();
29
  $('#only-post-author').prop( 'checked', false );
30
  $('#post-author').hide();
31
  toggle_fields();
32
  $('#user-password-msg').hide();
33
  } else {
34
+ $('#toggle-fields, #users, #email-formatting, #current-user, #post-author').show();
35
  toggle_fields();
36
  toggle_users();
37
  $('#user-password-msg').hide();
42
  $('#notification').on('change', function() {
43
  var $this = $(this);
44
  if ( 'user-password' === $this.val() || 'new-user' === $this.val() || 'welcome-email' === $this.val() || 'reply-comment' === $this.val() ) {
45
+ $('#toggle-fields, #email, #cc, #bcc, #users, #email-formatting, #current-user, #post-author').hide();
46
  $('#user-password-msg').show();
47
  } else if ( 'new-comment' === $('#notification').val() || 'new-trackback' === $('#notification').val() || 'new-pingback' === $('#notification').val() || 'admin-password' === $('#notification').val() || 'admin-user' === $('#notification').val() ) {
48
  $('#post-author').hide();
49
+ $('#toggle-fields, #users, #email-formatting, #current-user').show();
50
  $('#user-password-msg').hide();
51
  toggle_fields();
52
  } else {
53
+ $('#toggle-fields, #users, #email-formatting, #current-user, #post-author').show();
54
  $('#user-password-msg').hide();
55
  toggle_fields();
56
  }
bnfw.php CHANGED
@@ -3,18 +3,18 @@
3
  * Plugin Name: Better Notifications for WordPress
4
  * Plugin URI: http://wordpress.org/plugins/bnfw/
5
  * Description: Send customisable emails to your users for different WordPress notifications.
6
- * Version: 1.3.5
7
  * Author: Voltronik
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: plugins@voltronik.co.uk
10
  * License: GPLv2 or later
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  * Text Domain: bnfw
13
- * Domain Path: /languages
14
  */
15
 
16
  /**
17
- * Copyright © 2015 Voltronik (plugins@voltronik.co.uk)
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License, version 2, as
20
  * published by the Free Software Foundation.
3
  * Plugin Name: Better Notifications for WordPress
4
  * Plugin URI: http://wordpress.org/plugins/bnfw/
5
  * Description: Send customisable emails to your users for different WordPress notifications.
6
+ * Version: 1.3.4
7
  * Author: Voltronik
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: plugins@voltronik.co.uk
10
  * License: GPLv2 or later
11
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
  * Text Domain: bnfw
13
+ * Domain Path: languages/
14
  */
15
 
16
  /**
17
+ * Copyright © 2014 Voltronik (plugins@voltronik.co.uk)
18
  * This program is free software; you can redistribute it and/or modify
19
  * it under the terms of the GNU General Public License, version 2, as
20
  * published by the Free Software Foundation.
includes/admin/class-bnfw-notification.php CHANGED
@@ -357,7 +357,7 @@ class BNFW_Notification {
357
  <span class="dashicons dashicons-editor-help"></span> <?php _e( 'Need some help?', 'bnfw' ); ?>
358
  </p>
359
  <p>
360
- <a href="https://betternotificationsforwp.com/documentation/" target="_blank" class="button-secondary"><?php _e( 'Documentation', 'bnfw' ); ?></a>
361
  </p>
362
  <p>
363
  <a href="" target="_blank" id="shortcode-help" class="button-secondary"><?php _e( 'Shortcode Help', 'bnfw' ); ?></a>
@@ -367,12 +367,10 @@ class BNFW_Notification {
367
  <td>
368
  <?php wp_editor( $setting['message'], 'notification_message', array( 'media_buttons' => true ) ); ?>
369
  <p> &nbsp; </p>
370
- <div id="disable-autop">
371
- <label>
372
- <input type="checkbox" name="disable-autop" value="true" <?php checked( 'true', $setting['disable-autop'] ); ?>>
373
- <?php _e( 'Stop additional paragraph and line break HTML from being inserted into my notifications', 'bnfw' ); ?>
374
- </label>
375
- </div>
376
  </td>
377
  </tr>
378
 
@@ -829,7 +827,7 @@ class BNFW_Notification {
829
  $name = __( 'User Registration - For User', 'bnfw' );
830
  break;
831
  case 'welcome-email':
832
- $name = __( 'New User - Welcome Email', 'bnfw' );
833
  break;
834
  case 'admin-user':
835
  $name = __( 'User Registration - For Admin', 'bnfw' );
@@ -878,8 +876,7 @@ class BNFW_Notification {
878
  $name = $label . __( ' Comment', 'bnfw' );
879
  break;
880
  case 'newterm':
881
- $tax = get_taxonomy( $splited[1] );
882
- $name = __( 'New Term in ', 'bnfw' ) . $tax->labels->name;
883
  break;
884
  }
885
  break;
357
  <span class="dashicons dashicons-editor-help"></span> <?php _e( 'Need some help?', 'bnfw' ); ?>
358
  </p>
359
  <p>
360
+ <a href="https://betternotificationsforwp.com/documentation/?utm_source=WP%20Admin%20Notification%20Editor%20-%20'Documentation'&amp;utm_medium=referral&amp;utm_campaign=<?php echo home_url(); ?>" target="_blank" class="button-secondary"><?php _e( 'Documentation', 'bnfw' ); ?></a>
361
  </p>
362
  <p>
363
  <a href="" target="_blank" id="shortcode-help" class="button-secondary"><?php _e( 'Shortcode Help', 'bnfw' ); ?></a>
367
  <td>
368
  <?php wp_editor( $setting['message'], 'notification_message', array( 'media_buttons' => true ) ); ?>
369
  <p> &nbsp; </p>
370
+ <label>
371
+ <input type="checkbox" name="disable-autop" value="true" <?php checked( 'true', $setting['disable-autop'] ); ?>>
372
+ <?php _e( 'Stop additional paragraph and line break HTML from being inserted into my notifications', 'bnfw' ); ?>
373
+ </label>
 
 
374
  </td>
375
  </tr>
376
 
827
  $name = __( 'User Registration - For User', 'bnfw' );
828
  break;
829
  case 'welcome-email':
830
+ $name = __( 'New User - Welcome email', 'bnfw' );
831
  break;
832
  case 'admin-user':
833
  $name = __( 'User Registration - For Admin', 'bnfw' );
876
  $name = $label . __( ' Comment', 'bnfw' );
877
  break;
878
  case 'newterm':
879
+ $name = __( 'New term in ', 'bnfw' ) . $splited[1];
 
880
  break;
881
  }
882
  break;
includes/overrides.php CHANGED
@@ -9,15 +9,13 @@
9
  *
10
  * A new user registration notification is also sent to admin email.
11
  *
12
- * @param int $user_id User ID.
13
- * @param null $deprecated Not used (argument deprecated).
14
- * @param string $notify Optional. Type of notification that should happen. Accepts 'admin' or an empty
15
- * string (admin only), or 'both' (admin and user). The empty string value was kept
16
- * for backward-compatibility purposes with the renamed parameter. Default empty.
17
  */
18
  if ( ! function_exists( 'wp_new_user_notification' ) ) {
19
- function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
20
- global $wp_version, $wp_hasher;;
21
 
22
  $bnfw = BNFW::factory();
23
  $user = get_userdata( $user_id );
@@ -26,14 +24,6 @@ if ( ! function_exists( 'wp_new_user_notification' ) ) {
26
  // for WordPress 4.3 and above
27
  global $wpdb;
28
 
29
- if ( version_compare( $wp_version, '4.3', '=' ) ) {
30
- $notify = $deprecated;
31
- } else {
32
- if ( $deprecated !== null ) {
33
- _deprecated_argument( __FUNCTION__, '4.3.1' );
34
- }
35
- }
36
-
37
  // The blogname option is escaped with esc_html on the way into the database in sanitize_option
38
  // we want to reverse this for the plain text arena of emails.
39
  $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
@@ -46,13 +36,21 @@ if ( ! function_exists( 'wp_new_user_notification' ) ) {
46
  @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
47
  }
48
 
 
 
 
 
 
 
 
 
 
 
 
49
  if ( 'admin' === $notify || empty( $notify ) ) {
50
  return;
51
  }
52
 
53
- // Generate something random for a password reset key.
54
- $key = wp_generate_password( 20, false );
55
-
56
  /** This action is documented in wp-login.php */
57
  do_action( 'retrieve_password_key', $user->user_login, $key );
58
 
@@ -64,25 +62,17 @@ if ( ! function_exists( 'wp_new_user_notification' ) ) {
64
  $hashed = time() . ':' . $wp_hasher->HashPassword( $key );
65
  $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
66
 
67
- if ( $bnfw->notifier->notification_exists( 'new-user' ) ) {
68
- $notifications = $bnfw->notifier->get_notifications( 'new-user' );
69
- $password_url = network_site_url( "wp-login.php?action=rp&key=" . $key . "&login=" . rawurlencode( $user->user_login ), 'login' );
70
- foreach ( $notifications as $notification ) {
71
- $bnfw->engine->send_registration_email( $bnfw->notifier->read_settings( $notification->ID ), $user, $password_url );
72
- }
73
- } else {
74
- $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
75
- $message .= __('To set your password, visit the following address:') . "\r\n\r\n";
76
- $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
77
 
78
- $message .= wp_login_url() . "\r\n";
79
 
80
- wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
81
- }
82
  } else {
83
 
84
  // for WordPress below 4.3
85
- $plaintext_pass = $deprecated;
86
 
87
  // The blogname option is escaped with esc_html on the way into the database in sanitize_option
88
  // we want to reverse this for the plain text arena of emails.
9
  *
10
  * A new user registration notification is also sent to admin email.
11
  *
12
+ * @param int $user_id User ID.
13
+ * @param string $notify (optional) Optional. Whether admin and user should be notified ('both') or
14
+ * only the admin ('admin' or empty).
 
 
15
  */
16
  if ( ! function_exists( 'wp_new_user_notification' ) ) {
17
+ function wp_new_user_notification( $user_id, $notify = '' ) {
18
+ global $wp_version;
19
 
20
  $bnfw = BNFW::factory();
21
  $user = get_userdata( $user_id );
24
  // for WordPress 4.3 and above
25
  global $wpdb;
26
 
 
 
 
 
 
 
 
 
27
  // The blogname option is escaped with esc_html on the way into the database in sanitize_option
28
  // we want to reverse this for the plain text arena of emails.
29
  $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
36
  @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
37
  }
38
 
39
+ // Generate something random for a password reset key.
40
+ $key = wp_generate_password( 20, false );
41
+
42
+ if ( $bnfw->notifier->notification_exists( 'new-user' ) ) {
43
+ $notifications = $bnfw->notifier->get_notifications( 'new-user' );
44
+ $password_url = network_site_url( "wp-login.php?action=rp&key=" . $key . "&login=" . rawurlencode( $user->user_login ), 'login' );
45
+ foreach ( $notifications as $notification ) {
46
+ $bnfw->engine->send_registration_email( $bnfw->notifier->read_settings( $notification->ID ), $user, $password_url );
47
+ }
48
+ }
49
+
50
  if ( 'admin' === $notify || empty( $notify ) ) {
51
  return;
52
  }
53
 
 
 
 
54
  /** This action is documented in wp-login.php */
55
  do_action( 'retrieve_password_key', $user->user_login, $key );
56
 
62
  $hashed = time() . ':' . $wp_hasher->HashPassword( $key );
63
  $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
64
 
65
+ $message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
66
+ $message .= __('To set your password, visit the following address:') . "\r\n\r\n";
67
+ $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
 
 
 
 
 
 
 
68
 
69
+ $message .= wp_login_url() . "\r\n";
70
 
71
+ wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
 
72
  } else {
73
 
74
  // for WordPress below 4.3
75
+ $plaintext_pass = $notify;
76
 
77
  // The blogname option is escaped with esc_html on the way into the database in sanitize_option
78
  // we want to reverse this for the plain text arena of emails.
languages/{bnfw-pt_BR.mo → pt_BR.mo} RENAMED
File without changes
languages/{bnfw-pt_BR.po → pt_BR.po} RENAMED
File without changes