Better Notifications for WordPress - Version 1.5.3

Version Description

  • 13th September 2016 =
  • Fixed: User Roles in the 'User Roles / Users' admin column were being displayed only in lowercase.
  • Fixed: The [wp_capabilities] shortcode wasn't outputting properly. It now displays the higher-level capabilities that the user has.
Download this release

Release Info

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

Code changes from version 1.5.2 to 1.5.3

README.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Better Notifications for WordPress ===
2
  Contributors: voltronik
3
  Donate link: https://betternotificationsforwp.com/donate/
4
- 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
5
  Requires at least: 3.5
6
- Tested up to: 4.6
7
- Stable tag: 1.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -126,7 +126,7 @@ It's not designed to send out newsletters. There is no send-this-out-on-this-dat
126
 
127
  = How do I set-up WordPress to work with this plugin correctly? =
128
 
129
- This will very much depend on what notifications you're using the plugin for. Out-of-the-box, this plugin works very well but there are a few tweaks that you will need to ensure 100% compatibility. All the below points refer to this plugin:
130
 
131
  * If you want to use the new comment notifications in BNFW, you need to un-tick 'Email me whenever anyone posts a comment' and 'A comment is held for moderation' under Settings > Discussion. It's OK if you don't do this but you might receive WordPress's own email notifications along with the ones you've configure using BNFW. It also goes without saying that you need to enable comments for your posts if you want the email notifications to come through.
132
 
@@ -134,9 +134,9 @@ This will very much depend on what notifications you're using the plugin for. Ou
134
 
135
  = Notifications aren't coming through! =
136
 
137
- First of all, follow [this article](https://betternotificationsforwp.com/how-can-i-receive-the-best-support/) about how to find out what might be causing the problem. Additionally, this [very handy answer](http://stackoverflow.com/questions/371/how-do-you-make-sure-email-you-send-programmatically-is-not-automatically-marked) on Stack Overflow explains what you might need to do to make sure that emails don't make it through to your users SPAM / Junk folders. It's worth going through this and completing as much as you can.
138
 
139
- Many hosts place a limit on the number of emails that can be sent out within an hour so this may also cause some delay in emails arriving. MailPoet has a fairly extensive list of hosts and their corresponding email rate limits that's worth checkout [here](https://support.mailpoet.com/knowledgebase/lists-of-hosts-and-their-sending-limits/). Alternatively, please check with your host directly to find out what your limit is.
140
 
141
  If you're still having problems, please drop me a line in the [Free Support Forums](https://wordpress.org/support/plugin/bnfw) and I'll do my best to help.
142
 
@@ -178,17 +178,21 @@ An older version might work but this is untested. A lot of the newer features re
178
 
179
  == Changelog ==
180
 
 
 
 
 
181
  = 1.5.2 - 6th September 2016 =
182
  * Fixed: Custom User Roles were showing 0 users in the 'To' field.
183
  * Added: Generic CSS classes to BNFW admin.
184
- * Updated: German Translation to show English in certain places where translation text breaks the WP Admin UI.
185
  * Full code review and submission to WordPress VIP!
186
 
187
  = 1.5.1 - 5th August July 2016 =
188
  * Fixed: 'Text' mode in the WYSIWYG editor didn't show any buttons when the BNFW Per-post Override Add-on was activated.
189
 
190
  = 1.5 - 25th July 2016 =
191
- * New: Global Site Shortcodes! Include these in any notification to output the site title (`[global_site_title]`), site tagline (`[global_site_tagline]`), or site URL (`[global_site_URL]`).
192
  * New: Global User Shortcodes! Include these in any notification to output the user's first name (`[global_user_firstname]`), user's last name (`[global_user_lastname]`), or user's email address (`[global_user_email]`).
193
  * New: The 'User Role Changed' notification has been split into two transactional notifications - one that can be sent to users and one that can be sent to admins.
194
  * New: Shortcode `[featured_image]`. Outputs the URL for the featured image (if one is available).
1
  === Better Notifications for WordPress ===
2
  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.6.1
7
+ Stable tag: 1.5.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
126
 
127
  = How do I set-up WordPress to work with this plugin correctly? =
128
 
129
+ This will very much depend on what notifications you're using the plugin for. Out-of-the-box, this plugin works very well but there are a few tweaks that will ensure 100% compatibility. All the below points refer to this plugin:
130
 
131
  * If you want to use the new comment notifications in BNFW, you need to un-tick 'Email me whenever anyone posts a comment' and 'A comment is held for moderation' under Settings > Discussion. It's OK if you don't do this but you might receive WordPress's own email notifications along with the ones you've configure using BNFW. It also goes without saying that you need to enable comments for your posts if you want the email notifications to come through.
132
 
134
 
135
  = Notifications aren't coming through! =
136
 
137
+ First of all, follow [this article](https://betternotificationsforwp.com/how-can-i-receive-the-best-support/) about how to find out what might be causing the problem. Additionally, this [very handy answer](http://stackoverflow.com/questions/371/how-do-you-make-sure-email-you-send-programmatically-is-not-automatically-marked) on Stack Overflow explains what you might need to do to make sure that emails don't make it through to your user's SPAM / Junk folders. It's worth going through this and completing as much as you can.
138
 
139
+ Many hosts place a limit on the number of emails that can be sent out within an hour so this may also cause some delay in emails arriving. MailPoet has a fairly extensive list of hosts and their corresponding email rate limits that's worth checking out [here](https://support.mailpoet.com/knowledgebase/lists-of-hosts-and-their-sending-limits/). Alternatively, please check with your host directly to find out what your limit is.
140
 
141
  If you're still having problems, please drop me a line in the [Free Support Forums](https://wordpress.org/support/plugin/bnfw) and I'll do my best to help.
142
 
178
 
179
  == Changelog ==
180
 
181
+ = 1.5.3 - 13th September 2016 =
182
+ * Fixed: User Roles in the 'User Roles / Users' admin column were being displayed only in lowercase.
183
+ * Fixed: The `[wp_capabilities]` shortcode wasn't outputting properly. It now displays the higher-level capabilities that the user has.
184
+
185
  = 1.5.2 - 6th September 2016 =
186
  * Fixed: Custom User Roles were showing 0 users in the 'To' field.
187
  * Added: Generic CSS classes to BNFW admin.
188
+ * Updated: German Translation to show English in certain places where translation text breaks the WP Admin UI (props @helmi).
189
  * Full code review and submission to WordPress VIP!
190
 
191
  = 1.5.1 - 5th August July 2016 =
192
  * Fixed: 'Text' mode in the WYSIWYG editor didn't show any buttons when the BNFW Per-post Override Add-on was activated.
193
 
194
  = 1.5 - 25th July 2016 =
195
+ * New: Global Site Shortcodes! Include these in any notification to output the site title (`[global_site_title]`), site tagline (`[global_site_tagline]`), or site URL (`[global_site_url]`).
196
  * New: Global User Shortcodes! Include these in any notification to output the user's first name (`[global_user_firstname]`), user's last name (`[global_user_lastname]`), or user's email address (`[global_user_email]`).
197
  * New: The 'User Role Changed' notification has been split into two transactional notifications - one that can be sent to users and one that can be sent to admins.
198
  * New: Shortcode `[featured_image]`. Outputs the URL for the featured image (if one is available).
bnfw.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Better Notifications for WordPress
4
  * Plugin URI: https://wordpress.org/plugins/bnfw/
5
  * Description: Send customisable emails to your users for different WordPress notifications.
6
- * Version: 1.5.2
7
  * Author: Voltronik
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: Send customisable emails to your users for different WordPress notifications.
6
+ * Version: 1.5.3
7
  * Author: Voltronik
8
  * Author URI: https://betternotificationsforwp.com/
9
  * Author Email: hello@betternotificationsforwp.com
includes/admin/class-bnfw-notification.php CHANGED
@@ -856,14 +856,13 @@ class BNFW_Notification {
856
  * @since 1.2
857
  */
858
  private function get_names_from_users( $users ) {
859
- $email_list = array();
860
  $user_ids = array();
861
  $user_roles = array();
862
  $names_from_user_ids = array();
863
 
864
  foreach ( $users as $user ) {
865
  if ( $this->starts_with( $user, 'role-' ) ) {
866
- $user_roles[] = str_replace( 'role-', '', $user );
867
  } else {
868
  $user_ids[] = absint( $user );
869
  }
856
  * @since 1.2
857
  */
858
  private function get_names_from_users( $users ) {
 
859
  $user_ids = array();
860
  $user_roles = array();
861
  $names_from_user_ids = array();
862
 
863
  foreach ( $users as $user ) {
864
  if ( $this->starts_with( $user, 'role-' ) ) {
865
+ $user_roles[] = ucfirst( str_replace( 'role-', '', $user ) );
866
  } else {
867
  $user_ids[] = absint( $user );
868
  }
includes/engine/class-bnfw-engine.php CHANGED
@@ -432,8 +432,9 @@ class BNFW_Engine {
432
  $message = str_replace( '[user_avatar]', get_avatar_url( $user_id ), $message );
433
  $message = str_replace( '[commenter_avatar]', get_avatar_url( $user_id ), $message );
434
 
435
- if ( is_array( $user_info->wp_capabilities ) ) {
436
- $message = str_replace( '[wp_capabilities]', implode( ',', $user_info->wp_capabilities ), $message );
 
437
  }
438
 
439
  $message = apply_filters( 'bnfw_shortcodes_user', $message, $user_id );
432
  $message = str_replace( '[user_avatar]', get_avatar_url( $user_id ), $message );
433
  $message = str_replace( '[commenter_avatar]', get_avatar_url( $user_id ), $message );
434
 
435
+ $user_capabilities = bnfw_format_user_capabilities( $user_info->wp_capabilities );
436
+ if ( ! empty( $user_capabilities ) ) {
437
+ $message = str_replace( '[wp_capabilities]', $user_capabilities, $message );
438
  }
439
 
440
  $message = apply_filters( 'bnfw_shortcodes_user', $message, $user_id );
includes/helpers/helpers.php CHANGED
@@ -106,3 +106,24 @@ function bnfw_is_comment_notification( $notification_name ) {
106
 
107
  return $is_comment_notification;
108
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  return $is_comment_notification;
108
  }
109
+
110
+ /**
111
+ * Format user capabilities.
112
+ *
113
+ * @param array $wp_capabilities User capabilities.
114
+ *
115
+ * @return string Formatted capabilities.
116
+ */
117
+ function bnfw_format_user_capabilities( $wp_capabilities ) {
118
+ $capabilities = array();
119
+
120
+ if ( is_array( $wp_capabilities ) ) {
121
+ foreach ( $wp_capabilities as $capability => $enabled ) {
122
+ if ( $enabled ) {
123
+ $capabilities[] = $capability;
124
+ }
125
+ }
126
+ }
127
+
128
+ return implode( ', ', $capabilities );
129
+ }