Version Description
- 18th April 2017 =
- New: You can now use
[global_user_username]
in any notification to output the recipient's username. - 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.
- Improved: Clearer labelling on new custom post type notifications.
- Removed / Fixed: The addition of ACF Form compatibility in the last version was causing a range of issues, some minor, some serious. Until a more robust solution is found, this has been removed from the plugin whilst I try and get in touch with the author of ACF and work on a solution or collaboration.
- Fixed: The 'Send To' select box was being overlayed by the dropdown that shows when clicking in the box.
- Fixed: Searching for a user when a site has more than 200 users in the 'Send To' box now works as expected.
Download this release
Release Info
Developer | voltronik |
Plugin | Better Notifications for WordPress |
Version | 1.6.4 |
Comparing to | |
See all releases |
Code changes from version 1.6.3 to 1.6.4
- README.txt +9 -1
- assets/js/bnfw.js +1 -1
- bnfw.php +1 -11
- includes/admin/class-bnfw-notification.php +5 -5
- includes/engine/class-bnfw-engine.php +8 -2
- includes/helpers/helpers.php +22 -14
README.txt
CHANGED
@@ -4,7 +4,7 @@ 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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -200,6 +200,14 @@ An older version might work but this is untested. A lot of the newer features re
|
|
200 |
|
201 |
== Changelog ==
|
202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
= 1.6.3 - 13th March 2017 =
|
204 |
* Added: Support for the new [Send to Any Email add-on](https://betternotificationsforwp.com/downloads/send-to-any-email/).
|
205 |
* Added: Support for Advanced Custom Field (ACF) front-end forms. Finally!
|
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 |
|
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.
|
206 |
+
* Improved: Clearer labelling on new custom post type notifications.
|
207 |
+
* Removed / Fixed: The addition of ACF Form compatibility in the last version was causing a range of issues, some minor, some serious. Until a more robust solution is found, this has been removed from the plugin whilst I try and get in touch with the author of ACF and work on a solution or collaboration.
|
208 |
+
* Fixed: The 'Send To' select box was being overlayed by the dropdown that shows when clicking in the box.
|
209 |
+
* Fixed: Searching for a user when a site has more than 200 users in the 'Send To' box now works as expected.
|
210 |
+
|
211 |
= 1.6.3 - 13th March 2017 =
|
212 |
* Added: Support for the new [Send to Any Email add-on](https://betternotificationsforwp.com/downloads/send-to-any-email/).
|
213 |
* Added: Support for Advanced Custom Field (ACF) front-end forms. Finally!
|
assets/js/bnfw.js
CHANGED
@@ -197,6 +197,6 @@ jQuery(document).ready(function($) {
|
|
197 |
break;
|
198 |
}
|
199 |
|
200 |
-
$(this).attr( 'href', 'https://betternotificationsforwp.com/shortcodes/?notification=' + notification_slug + '&utm_source=WP%20Admin%20Notification%20Editor%20-%20"Shortcode%20Help"&utm_medium=referral' );
|
201 |
});
|
202 |
});
|
197 |
break;
|
198 |
}
|
199 |
|
200 |
+
$(this).attr( 'href', 'https://betternotificationsforwp.com/documentation/notifications/shortcodes/?notification=' + notification_slug + '&utm_source=WP%20Admin%20Notification%20Editor%20-%20"Shortcode%20Help"&utm_medium=referral' );
|
201 |
});
|
202 |
});
|
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.6.
|
7 |
* Author: Voltronik
|
8 |
* Author URI: https://betternotificationsforwp.com/
|
9 |
* Author Email: hello@betternotificationsforwp.com
|
@@ -134,7 +134,6 @@ 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 |
-
add_action( 'acf/save_post' , array( $this, 'acf_save_post' ) );
|
138 |
|
139 |
add_action( 'publish_to_publish' , array( $this, 'update_post' ) );
|
140 |
|
@@ -232,15 +231,6 @@ class BNFW {
|
|
232 |
$this->publish_post( $post );
|
233 |
}
|
234 |
|
235 |
-
/**
|
236 |
-
* Trigger New Post published notification for ACF forms.
|
237 |
-
*
|
238 |
-
* @param int $post_id Post ID.
|
239 |
-
*/
|
240 |
-
public function acf_save_post( $post_id ) {
|
241 |
-
$this->publish_post( get_post( $post_id ) );
|
242 |
-
}
|
243 |
-
|
244 |
/**
|
245 |
* Fires when a post is created for the first time.
|
246 |
*
|
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
|
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 |
$this->publish_post( $post );
|
232 |
}
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
/**
|
235 |
* Fires when a post is created for the first time.
|
236 |
*
|
includes/admin/class-bnfw-notification.php
CHANGED
@@ -236,9 +236,9 @@ class BNFW_Notification {
|
|
236 |
<optgroup
|
237 |
label="<?php esc_attr( printf( "%s - '%s'", esc_html__( 'Custom Post Type', 'bnfw' ), $label ) ); ?>">
|
238 |
<option
|
239 |
-
value="new-<?php echo esc_attr( $type ); ?>" <?php selected( 'new-' . $type, $setting['notification'] ); ?>><?php echo esc_html__( 'New ', 'bnfw' ), "'$label'"; ?></option>
|
240 |
<option
|
241 |
-
value="update-<?php echo esc_attr( $type ); ?>" <?php selected( 'update-' . $type, $setting['notification'] ); ?>><?php echo "'$label' " . esc_html__( '
|
242 |
<option
|
243 |
value="pending-<?php echo esc_attr( $type ); ?>" <?php selected( 'pending-' . $type, $setting['notification'] ); ?>><?php echo "'$label' ", esc_html__( 'Pending Review', 'bnfw' ); ?></option>
|
244 |
<option
|
@@ -495,8 +495,8 @@ class BNFW_Notification {
|
|
495 |
wp_deregister_script( 'um_admin_scripts' );
|
496 |
wp_dequeue_script( 'um_admin_scripts' );
|
497 |
|
498 |
-
wp_enqueue_style( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.
|
499 |
-
wp_enqueue_script( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.
|
500 |
|
501 |
wp_enqueue_script( 'bnfw', plugins_url( '../assets/js/bnfw.js', dirname( __FILE__ ) ), array( 'select2' ), '0.1', true );
|
502 |
wp_enqueue_style( 'bnfw', plugins_url( '../assets/css/bnfw.css', dirname( __FILE__ ) ), array( 'dashicons', 'select2' ), '0.1' );
|
@@ -1019,7 +1019,7 @@ class BNFW_Notification {
|
|
1019 |
|
1020 |
switch ( $splited[0] ) {
|
1021 |
case 'new':
|
1022 |
-
$name = esc_html__( 'New ', 'bnfw' ) . $label;
|
1023 |
break;
|
1024 |
case 'update':
|
1025 |
$name = esc_html__( 'Updated ', 'bnfw' ) . $label;
|
236 |
<optgroup
|
237 |
label="<?php esc_attr( printf( "%s - '%s'", esc_html__( 'Custom Post Type', 'bnfw' ), $label ) ); ?>">
|
238 |
<option
|
239 |
+
value="new-<?php echo esc_attr( $type ); ?>" <?php selected( 'new-' . $type, $setting['notification'] ); ?>><?php echo esc_html__( 'New ', 'bnfw' ), "'$label'", esc_html__( ' Published', 'bnfw' ); ?></option>
|
240 |
<option
|
241 |
+
value="update-<?php echo esc_attr( $type ); ?>" <?php selected( 'update-' . $type, $setting['notification'] ); ?>><?php echo "'$label' " . esc_html__( 'Updated', 'bnfw' ); ?></option>
|
242 |
<option
|
243 |
value="pending-<?php echo esc_attr( $type ); ?>" <?php selected( 'pending-' . $type, $setting['notification'] ); ?>><?php echo "'$label' ", esc_html__( 'Pending Review', 'bnfw' ); ?></option>
|
244 |
<option
|
495 |
wp_deregister_script( 'um_admin_scripts' );
|
496 |
wp_dequeue_script( 'um_admin_scripts' );
|
497 |
|
498 |
+
wp_enqueue_style( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css', array(), '4.0.3' );
|
499 |
+
wp_enqueue_script( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.full.min.js', array( 'jquery' ), '4.0.3', true );
|
500 |
|
501 |
wp_enqueue_script( 'bnfw', plugins_url( '../assets/js/bnfw.js', dirname( __FILE__ ) ), array( 'select2' ), '0.1', true );
|
502 |
wp_enqueue_style( 'bnfw', plugins_url( '../assets/css/bnfw.css', dirname( __FILE__ ) ), array( 'dashicons', 'select2' ), '0.1' );
|
1019 |
|
1020 |
switch ( $splited[0] ) {
|
1021 |
case 'new':
|
1022 |
+
$name = esc_html__( 'New ', 'bnfw' ) . $label . ' ' . esc_html__( 'Published', 'bnfw' );
|
1023 |
break;
|
1024 |
case 'update':
|
1025 |
$name = esc_html__( 'Updated ', 'bnfw' ) . $label;
|
includes/engine/class-bnfw-engine.php
CHANGED
@@ -450,10 +450,13 @@ class BNFW_Engine {
|
|
450 |
if ( false === $user ) {
|
451 |
$message = str_replace( '[global_user_firstname]', $email, $message );
|
452 |
$message = str_replace( '[global_user_lastname]', $email, $message );
|
|
|
453 |
} else {
|
454 |
$message = str_replace( '[global_user_firstname]', $user->first_name, $message );
|
455 |
$message = str_replace( '[global_user_lastname]', $user->last_name, $message );
|
|
|
456 |
}
|
|
|
457 |
$message = str_replace( '[global_user_email]', $email, $message );
|
458 |
|
459 |
return $message;
|
@@ -599,7 +602,7 @@ class BNFW_Engine {
|
|
599 |
*
|
600 |
* @return string Processed string.
|
601 |
*/
|
602 |
-
|
603 |
$user_info = get_userdata( $user_id );
|
604 |
|
605 |
// deperecated
|
@@ -830,7 +833,10 @@ class BNFW_Engine {
|
|
830 |
continue;
|
831 |
}
|
832 |
}
|
833 |
-
|
|
|
|
|
|
|
834 |
}
|
835 |
}
|
836 |
|
450 |
if ( false === $user ) {
|
451 |
$message = str_replace( '[global_user_firstname]', $email, $message );
|
452 |
$message = str_replace( '[global_user_lastname]', $email, $message );
|
453 |
+
$message = str_replace( '[global_user_username]', $email, $message );
|
454 |
} else {
|
455 |
$message = str_replace( '[global_user_firstname]', $user->first_name, $message );
|
456 |
$message = str_replace( '[global_user_lastname]', $user->last_name, $message );
|
457 |
+
$message = str_replace( '[global_user_username]', $user->user_login, $message );
|
458 |
}
|
459 |
+
|
460 |
$message = str_replace( '[global_user_email]', $email, $message );
|
461 |
|
462 |
return $message;
|
602 |
*
|
603 |
* @return string Processed string.
|
604 |
*/
|
605 |
+
public function user_shortcodes( $message, $user_id ) {
|
606 |
$user_info = get_userdata( $user_id );
|
607 |
|
608 |
// deperecated
|
833 |
continue;
|
834 |
}
|
835 |
}
|
836 |
+
|
837 |
+
if ( ! in_array( $user->user_email, $email_list ) ) {
|
838 |
+
$email_list[] = $user->user_email;
|
839 |
+
}
|
840 |
}
|
841 |
}
|
842 |
|
includes/helpers/helpers.php
CHANGED
@@ -60,24 +60,32 @@ function bnfw_render_users_dropdown( $selected_users ) {
|
|
60 |
}
|
61 |
?>
|
62 |
</optgroup>
|
|
|
63 |
<optgroup label="Users">
|
64 |
<?php
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
80 |
|
|
|
|
|
81 |
foreach ( $users as $user ) {
|
82 |
$selected = selected( true, in_array( $user->ID, $selected_users ), false );
|
83 |
|
60 |
}
|
61 |
?>
|
62 |
</optgroup>
|
63 |
+
|
64 |
<optgroup label="Users">
|
65 |
<?php
|
66 |
+
$args = array(
|
67 |
+
'order_by' => 'email',
|
68 |
+
'fields' => array( 'ID', 'user_login' ),
|
69 |
+
'number' => 200,
|
70 |
+
);
|
71 |
+
|
72 |
+
// if there are more than 200 users then use AJAX to load them dynamically.
|
73 |
+
// So just get only the selected users.
|
74 |
+
if ( $user_count['total_users'] > 200 ) {
|
75 |
+
$selected_user_ids = array();
|
76 |
+
foreach ( $selected_users as $selected_user ) {
|
77 |
+
if ( absint( $selected_user ) > 0 ) {
|
78 |
+
$selected_user_ids[] = $selected_user;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
if ( $selected_user_ids > 0 ) {
|
83 |
+
$args['include'] = $selected_user_ids;
|
84 |
+
}
|
85 |
}
|
86 |
|
87 |
+
$users = get_users( $args );
|
88 |
+
|
89 |
foreach ( $users as $user ) {
|
90 |
$selected = selected( true, in_array( $user->ID, $selected_users ), false );
|
91 |
|