Version Description
- 8th April 2020 =
- POTENTIAL BREAKING CHANGES - Please edit and re-save each comment notification you have set-up to ensure that the correct notification is selected and saved.
- New: A huge overhaul of the comment notifications which now gives a great comment management workflow.
- New: New Comment, New Comment Awaiting Moderation, Comment Approved, and Comment Reply notifications are now availble to all posts, pages, custom post types, and media attachments.
- Improved: The 'Send this notification to the Author' checkbox has been overhauled to work better for the above notifications. See the relevant section in this support document for more information.
Download this release
Release Info
Developer | voltronik |
Plugin | Better Notifications for WordPress |
Version | 1.8 |
Comparing to | |
See all releases |
Code changes from version 1.7.7 to 1.8
- README.txt +12 -2
- assets/js/bnfw.js +16 -10
- bnfw.php +32 -6
- includes/admin/class-bnfw-notification.php +36 -8
- includes/engine/class-bnfw-engine.php +16 -1
- includes/helpers/helpers.php +1 -2
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
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 1.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -94,7 +94,7 @@ The notifications that are currently available to use are:
|
|
94 |
* Published Post Moved to Trash
|
95 |
* New Comment
|
96 |
* New Comment Awaiting Moderation
|
97 |
-
* Comment Approved
|
98 |
* Post - Custom Field Updated ([Custom Fields Add-on](https://betternotificationsforwp.com/downloads/custom-fields/))
|
99 |
* Post - Update Reminder ([Reminders Add-on](https://betternotificationsforwp.com/downloads/update-reminder/))
|
100 |
* New Trackback
|
@@ -109,6 +109,7 @@ The notifications that are currently available to use are:
|
|
109 |
* Page Scheduled
|
110 |
* Page - New Comment
|
111 |
* Page - New Comment Awaiting Moderation
|
|
|
112 |
* Page - Comment Reply
|
113 |
* Page - Custom Field Updated ([Custom Fields Add-on](https://betternotificationsforwp.com/downloads/custom-fields/))
|
114 |
* Page - Update Reminder ([Reminders Add-on](https://betternotificationsforwp.com/downloads/update-reminder/))
|
@@ -118,6 +119,9 @@ The notifications that are currently available to use are:
|
|
118 |
* New Media Published
|
119 |
* Media Updated
|
120 |
* Media - New Comment
|
|
|
|
|
|
|
121 |
|
122 |
**Posts**
|
123 |
|
@@ -230,6 +234,12 @@ Yes, of course! The plugin is completely translation-friendly and if you send me
|
|
230 |
|
231 |
== Changelog ==
|
232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
233 |
= 1.7.7 - 27th March 2020 =
|
234 |
* New: Three new notifications! "New Media Published", "Media Updated", "Media Comment" - complete with new shortcodes for caption, alt text, dimensions, etc.
|
235 |
* New: "User Logged In - For Admin" notification - sends a notification to the admin when users log in.
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.4
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 1.8
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
94 |
* Published Post Moved to Trash
|
95 |
* New Comment
|
96 |
* New Comment Awaiting Moderation
|
97 |
+
* Post - Comment Approved
|
98 |
* Post - Custom Field Updated ([Custom Fields Add-on](https://betternotificationsforwp.com/downloads/custom-fields/))
|
99 |
* Post - Update Reminder ([Reminders Add-on](https://betternotificationsforwp.com/downloads/update-reminder/))
|
100 |
* New Trackback
|
109 |
* Page Scheduled
|
110 |
* Page - New Comment
|
111 |
* Page - New Comment Awaiting Moderation
|
112 |
+
* Page - Comment Approved
|
113 |
* Page - Comment Reply
|
114 |
* Page - Custom Field Updated ([Custom Fields Add-on](https://betternotificationsforwp.com/downloads/custom-fields/))
|
115 |
* Page - Update Reminder ([Reminders Add-on](https://betternotificationsforwp.com/downloads/update-reminder/))
|
119 |
* New Media Published
|
120 |
* Media Updated
|
121 |
* Media - New Comment
|
122 |
+
* Media - New Comment Awaiting Moderation
|
123 |
+
* Media - Comment Approved
|
124 |
+
* Media - Comment Reply
|
125 |
|
126 |
**Posts**
|
127 |
|
234 |
|
235 |
== Changelog ==
|
236 |
|
237 |
+
= 1.8 - 8th April 2020 =
|
238 |
+
* POTENTIAL BREAKING CHANGES - Please edit and re-save each comment notification you have set-up to ensure that the correct notification is selected and saved.
|
239 |
+
* New: A huge overhaul of the comment notifications which now gives a great comment management workflow.
|
240 |
+
* New: New Comment, New Comment Awaiting Moderation, Comment Approved, and Comment Reply notifications are now availble to all posts, pages, custom post types, and media attachments.
|
241 |
+
* Improved: The 'Send this notification to the Author' checkbox has been overhauled to work better for the above notifications. See the relevant section in [this support document](https://betternotificationsforwp.com/documentation/notifications/adding-a-new-notification/) for more information.
|
242 |
+
|
243 |
= 1.7.7 - 27th March 2020 =
|
244 |
* New: Three new notifications! "New Media Published", "Media Updated", "Media Comment" - complete with new shortcodes for caption, alt text, dimensions, etc.
|
245 |
* New: "User Logged In - For Admin" notification - sends a notification to the admin when users log in.
|
assets/js/bnfw.js
CHANGED
@@ -40,8 +40,8 @@ jQuery(document).ready(function($) {
|
|
40 |
}
|
41 |
|
42 |
var notification = $( '#notification' ).val();
|
43 |
-
|
44 |
-
if ( 'new-comment' === notification || 'approve
|
45 |
$( '#current-user' ).show();
|
46 |
}
|
47 |
}
|
@@ -81,6 +81,8 @@ jQuery(document).ready(function($) {
|
|
81 |
|
82 |
toggle_fields();
|
83 |
|
|
|
|
|
84 |
if ( 'reply-comment' === notification || notification.startsWith( 'commentreply-' ) ||
|
85 |
'new-user' === notification || 'welcome-email' === notification || 'user-password' === notification ||
|
86 |
'password-changed' === notification || 'email-changed' === notification || 'email-changing' === notification || 'user-role' === notification ||
|
@@ -110,10 +112,10 @@ jQuery(document).ready(function($) {
|
|
110 |
|
111 |
$( '#email-formatting' ).hide();
|
112 |
}
|
113 |
-
} else if ( 'new-comment' === notification || 'approve
|
114 |
'admin-password' === notification || 'admin-user' === notification || 'admin-role' === notification ) {
|
115 |
|
116 |
-
if ( 'new-comment' === notification || 'approve
|
117 |
$('#post-author').show();
|
118 |
} else {
|
119 |
$('#post-author').hide();
|
@@ -159,6 +161,8 @@ jQuery(document).ready(function($) {
|
|
159 |
var $this = $(this),
|
160 |
notification = $this.val();
|
161 |
|
|
|
|
|
162 |
if ( 'reply-comment' === notification || notification.startsWith( 'commentreply-' ) ||
|
163 |
'new-user' === notification || 'welcome-email' === notification || 'user-password' === notification ||
|
164 |
'password-changed' === notification || 'email-changed' === notification || 'email-changing' === notification || 'user-role' === notification ||
|
@@ -188,11 +192,11 @@ jQuery(document).ready(function($) {
|
|
188 |
|
189 |
$( '#email-formatting' ).hide();
|
190 |
}
|
191 |
-
} else if ( 'new-comment' === notification || 'approve
|
192 |
notification.startsWith( 'moderate-comment-' ) || 'new-trackback' === notification || 'new-pingback' === notification ||
|
193 |
'admin-password' === notification || 'admin-user' === notification || 'admin-role' === notification ) {
|
194 |
|
195 |
-
if ( 'new-comment' === notification || 'approve
|
196 |
$('#post-author').show();
|
197 |
} else {
|
198 |
$('#post-author').hide();
|
@@ -250,7 +254,6 @@ jQuery(document).ready(function($) {
|
|
250 |
splited;
|
251 |
|
252 |
switch( notification ) {
|
253 |
-
case 'approve-comment':
|
254 |
case 'new-comment':
|
255 |
case 'new-trackback':
|
256 |
case 'new-pingback':
|
@@ -264,8 +267,8 @@ jQuery(document).ready(function($) {
|
|
264 |
case 'email-changed':
|
265 |
case 'email-changing':
|
266 |
case 'new-user':
|
267 |
-
|
268 |
-
|
269 |
case 'welcome-email':
|
270 |
case 'user-role':
|
271 |
case 'admin-role':
|
@@ -277,7 +280,7 @@ jQuery(document).ready(function($) {
|
|
277 |
case 'future-post':
|
278 |
case 'newterm-category':
|
279 |
case 'new-media':
|
280 |
-
case 'comment-
|
281 |
case 'update-media':
|
282 |
case 'newterm-post_tag':
|
283 |
notification_slug = notification;
|
@@ -304,6 +307,9 @@ jQuery(document).ready(function($) {
|
|
304 |
case 'comment':
|
305 |
notification_slug = 'new-comment';
|
306 |
break;
|
|
|
|
|
|
|
307 |
case 'moderate':
|
308 |
notification_slug = 'moderate-comment';
|
309 |
break;
|
40 |
}
|
41 |
|
42 |
var notification = $( '#notification' ).val();
|
43 |
+
var check_comment = notification.split('-');
|
44 |
+
if ( 'new-comment' === notification || 'approve' === check_comment[0] || 'moderate-comment' === notification ) {
|
45 |
$( '#current-user' ).show();
|
46 |
}
|
47 |
}
|
81 |
|
82 |
toggle_fields();
|
83 |
|
84 |
+
var check_comment = notification.split('-');
|
85 |
+
|
86 |
if ( 'reply-comment' === notification || notification.startsWith( 'commentreply-' ) ||
|
87 |
'new-user' === notification || 'welcome-email' === notification || 'user-password' === notification ||
|
88 |
'password-changed' === notification || 'email-changed' === notification || 'email-changing' === notification || 'user-role' === notification ||
|
112 |
|
113 |
$( '#email-formatting' ).hide();
|
114 |
}
|
115 |
+
} else if ( 'new-comment' === notification || 'approve' === check_comment[0] || notification.startsWith( 'moderate-comment-' ) || 'new-trackback' === notification || 'new-pingback' === notification ||
|
116 |
'admin-password' === notification || 'admin-user' === notification || 'admin-role' === notification ) {
|
117 |
|
118 |
+
if ( 'new-comment' === notification || 'approve' === check_comment[0] || notification.startsWith( 'moderate-comment-' ) || 'new-trackback' === notification || 'new-pingback' === notification ) {
|
119 |
$('#post-author').show();
|
120 |
} else {
|
121 |
$('#post-author').hide();
|
161 |
var $this = $(this),
|
162 |
notification = $this.val();
|
163 |
|
164 |
+
var check_comment = notification.split('-');
|
165 |
+
|
166 |
if ( 'reply-comment' === notification || notification.startsWith( 'commentreply-' ) ||
|
167 |
'new-user' === notification || 'welcome-email' === notification || 'user-password' === notification ||
|
168 |
'password-changed' === notification || 'email-changed' === notification || 'email-changing' === notification || 'user-role' === notification ||
|
192 |
|
193 |
$( '#email-formatting' ).hide();
|
194 |
}
|
195 |
+
} else if ( 'new-comment' === notification || 'approve' === check_comment[0] ||
|
196 |
notification.startsWith( 'moderate-comment-' ) || 'new-trackback' === notification || 'new-pingback' === notification ||
|
197 |
'admin-password' === notification || 'admin-user' === notification || 'admin-role' === notification ) {
|
198 |
|
199 |
+
if ( 'new-comment' === notification || 'approve' === check_comment[0] || notification.startsWith( 'moderate-comment-' ) || 'new-trackback' === notification || 'new-pingback' === notification ) {
|
200 |
$('#post-author').show();
|
201 |
} else {
|
202 |
$('#post-author').hide();
|
254 |
splited;
|
255 |
|
256 |
switch( notification ) {
|
|
|
257 |
case 'new-comment':
|
258 |
case 'new-trackback':
|
259 |
case 'new-pingback':
|
267 |
case 'email-changed':
|
268 |
case 'email-changing':
|
269 |
case 'new-user':
|
270 |
+
case 'user-login':
|
271 |
+
case 'admin-user-login':
|
272 |
case 'welcome-email':
|
273 |
case 'user-role':
|
274 |
case 'admin-role':
|
280 |
case 'future-post':
|
281 |
case 'newterm-category':
|
282 |
case 'new-media':
|
283 |
+
case 'comment-attachment':
|
284 |
case 'update-media':
|
285 |
case 'newterm-post_tag':
|
286 |
notification_slug = notification;
|
307 |
case 'comment':
|
308 |
notification_slug = 'new-comment';
|
309 |
break;
|
310 |
+
case 'approve':
|
311 |
+
notification_slug = 'approve-comment';
|
312 |
+
break;
|
313 |
case 'moderate':
|
314 |
notification_slug = 'moderate-comment';
|
315 |
break;
|
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.
|
7 |
* Author: Made with Fuel
|
8 |
* Author URI: https://betternotificationsforwp.com/
|
9 |
* Author Email: hello@betternotificationsforwp.com
|
@@ -516,7 +516,23 @@ class BNFW {
|
|
516 |
return;
|
517 |
}
|
518 |
|
519 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
520 |
}
|
521 |
|
522 |
/**
|
@@ -541,13 +557,23 @@ class BNFW {
|
|
541 |
$notification_type = 'comment-' . $post->post_type;
|
542 |
}
|
543 |
|
544 |
-
if('attachment' == $post->post_type){
|
545 |
-
$notification_type = 'comment-media';
|
546 |
-
}
|
547 |
-
|
548 |
$this->send_notification( $notification_type, $comment_id );
|
|
|
|
|
|
|
549 |
}
|
|
|
550 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
551 |
// comment reply notification.
|
552 |
if ( $this->can_send_comment_notification( $the_comment ) ) {
|
553 |
if ( $the_comment->comment_parent > 0 ) {
|
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
|
7 |
* Author: Made with Fuel
|
8 |
* Author URI: https://betternotificationsforwp.com/
|
9 |
* Author Email: hello@betternotificationsforwp.com
|
516 |
return;
|
517 |
}
|
518 |
|
519 |
+
$post = get_post( $comment->comment_post_ID );
|
520 |
+
|
521 |
+
$notification_type = 'approve-'.$post->post_type.'-comment';
|
522 |
+
|
523 |
+
$this->send_notification( $notification_type, $comment->comment_ID );
|
524 |
+
|
525 |
+
// Send new comment notification after comment approve
|
526 |
+
$notification_type = 'new-comment'; // old notification name
|
527 |
+
|
528 |
+
if ( 'post' != $post->post_type ) {
|
529 |
+
$notification_type = 'comment-' . $post->post_type;
|
530 |
+
}
|
531 |
+
|
532 |
+
$this->send_notification( $notification_type, $comment->comment_ID );
|
533 |
+
|
534 |
+
// Send comment reply notification after comment approve.
|
535 |
+
$this->commentsReply($comment->comment_ID);
|
536 |
}
|
537 |
|
538 |
/**
|
557 |
$notification_type = 'comment-' . $post->post_type;
|
558 |
}
|
559 |
|
|
|
|
|
|
|
|
|
560 |
$this->send_notification( $notification_type, $comment_id );
|
561 |
+
|
562 |
+
// comment reply notification.
|
563 |
+
$this->commentsReply($comment_id);
|
564 |
}
|
565 |
+
}
|
566 |
|
567 |
+
/**
|
568 |
+
* Send notification for comments reply
|
569 |
+
*
|
570 |
+
* @since 1.0
|
571 |
+
* @param int $comment_id
|
572 |
+
*/
|
573 |
+
public function commentsReply($comment_id) {
|
574 |
+
$the_comment = get_comment( $comment_id );
|
575 |
+
$post = get_post( $the_comment->comment_post_ID );
|
576 |
+
|
577 |
// comment reply notification.
|
578 |
if ( $this->can_send_comment_notification( $the_comment ) ) {
|
579 |
if ( $the_comment->comment_parent > 0 ) {
|
includes/admin/class-bnfw-notification.php
CHANGED
@@ -226,8 +226,6 @@ class BNFW_Notification {
|
|
226 |
value="welcome-email" <?php selected( 'welcome-email', $setting['notification'] ); ?>><?php esc_html_e( 'New User - Post-registration Email', 'bnfw' ); ?></option>
|
227 |
<option
|
228 |
value="user-password" <?php selected( 'user-password', $setting['notification'] ); ?>><?php esc_html_e( 'User Lost Password - For User', 'bnfw' ); ?></option>
|
229 |
-
<option
|
230 |
-
value="user-login" <?php selected( 'user-login', $setting['notification'] ); ?>><?php esc_html_e( 'User Logged In - For User', 'bnfw' ); ?></option>
|
231 |
<option
|
232 |
value="password-changed" <?php selected( 'password-changed', $setting['notification'] ); ?>><?php esc_html_e( 'Password Changed - For User', 'bnfw' ); ?></option>
|
233 |
<option value="email-changing" <?php selected( 'email-changing', $setting['notification'] ); ?>>
|
@@ -237,6 +235,8 @@ class BNFW_Notification {
|
|
237 |
value="email-changed" <?php selected( 'email-changed', $setting['notification'] ); ?>><?php esc_html_e( 'User Email Changed - For User', 'bnfw' ); ?></option>
|
238 |
<option
|
239 |
value="user-role" <?php selected( 'user-role', $setting['notification'] ); ?>><?php esc_html_e( 'User Role Changed - For User', 'bnfw' ); ?></option>
|
|
|
|
|
240 |
<option
|
241 |
value="reply-comment" <?php selected( 'reply-comment', $setting['notification'] ); ?>><?php esc_html_e( 'Comment Reply', 'bnfw' ); ?></option>
|
242 |
|
@@ -281,8 +281,8 @@ class BNFW_Notification {
|
|
281 |
<option value="moderate-post-comment" <?php selected( 'moderate-post-comment', $setting['notification'] ); ?>>
|
282 |
<?php esc_html_e( 'New Comment Awaiting Moderation', 'bnfw' ); ?>
|
283 |
</option>
|
284 |
-
<option value="approve-comment" <?php selected( 'approve-comment', $setting['notification'] ); ?>>
|
285 |
-
<?php esc_html_e( 'Comment Approved', 'bnfw' ); ?>
|
286 |
</option>
|
287 |
<option
|
288 |
value="newterm-category" <?php selected( 'newterm-category', $setting['notification'] ); ?>><?php esc_html_e( 'New Category', 'bnfw' ); ?></option>
|
@@ -312,6 +312,9 @@ class BNFW_Notification {
|
|
312 |
<option value="moderate-page-comment" <?php selected( 'moderate-page-comment', $setting['notification'] ); ?>>
|
313 |
<?php esc_html_e( 'Page - New Comment Awaiting Moderation', 'bnfw' ); ?>
|
314 |
</option>
|
|
|
|
|
|
|
315 |
<option
|
316 |
value="commentreply-page" <?php selected( 'commentreply-page', $setting['notification'] ); ?>><?php esc_html_e( 'Page - Comment Reply', 'bnfw' ); ?></option>
|
317 |
<?php do_action( 'bnfw_after_notification_options', 'page', 'Page', $setting ); ?>
|
@@ -324,7 +327,14 @@ class BNFW_Notification {
|
|
324 |
<option
|
325 |
value="update-media" <?php selected( 'update-media', $setting['notification'] ); ?>><?php esc_html_e( 'Media Updated', 'bnfw' ); ?></option>
|
326 |
<option
|
327 |
-
value="comment-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
<?php do_action( 'bnfw_after_notification_options', 'media', 'Media', $setting ); ?>
|
329 |
</optgroup>
|
330 |
<?php do_action( 'bnfw_after_notification_options_optgroup', 'media', 'Media', $setting ); ?>
|
@@ -358,6 +368,9 @@ class BNFW_Notification {
|
|
358 |
<option value="moderate-<?php echo esc_attr( $type ); ?>-comment" <?php selected( 'moderate-' . $type . '-comment', $setting['notification'] ); ?>>
|
359 |
<?php echo "'$label' - ", esc_html__( 'New Comment Awaiting Moderation', 'bnfw' ); ?>
|
360 |
</option>
|
|
|
|
|
|
|
361 |
<option
|
362 |
value="commentreply-<?php echo esc_attr( $type ); ?>" <?php selected( 'commentreply-' . $type, $setting['notification'] ); ?>><?php echo "'$label' ", esc_html__( 'Comment Reply', 'bnfw' ); ?></option>
|
363 |
<?php do_action( 'bnfw_after_notification_options', $type, $label, $setting ); ?>
|
@@ -1228,8 +1241,8 @@ foreach ( $taxs as $tax ) {
|
|
1228 |
case 'new-comment':
|
1229 |
$name = esc_html__( 'New Comment', 'bnfw' );
|
1230 |
break;
|
1231 |
-
case 'approve-comment':
|
1232 |
-
$name = esc_html__( 'Comment Approved', 'bnfw' );
|
1233 |
break;
|
1234 |
case 'moderate-comment':
|
1235 |
$name = esc_html__( 'New Comment Awaiting Moderation', 'bnfw' );
|
@@ -1339,9 +1352,21 @@ foreach ( $taxs as $tax ) {
|
|
1339 |
case 'update-media':
|
1340 |
$name = esc_html__( 'Media Updated', 'bnfw' );
|
1341 |
break;
|
1342 |
-
case 'comment-
|
1343 |
$name = esc_html__( 'Media - New Comment', 'bnfw' );
|
1344 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1345 |
|
1346 |
|
1347 |
default:
|
@@ -1378,6 +1403,9 @@ foreach ( $taxs as $tax ) {
|
|
1378 |
case 'commentreply':
|
1379 |
$name = $label . esc_html__( ' Comment Reply', 'bnfw' );
|
1380 |
break;
|
|
|
|
|
|
|
1381 |
case 'newterm':
|
1382 |
$tax = get_taxonomy( $splited[1] );
|
1383 |
if ( ! $tax ) {
|
226 |
value="welcome-email" <?php selected( 'welcome-email', $setting['notification'] ); ?>><?php esc_html_e( 'New User - Post-registration Email', 'bnfw' ); ?></option>
|
227 |
<option
|
228 |
value="user-password" <?php selected( 'user-password', $setting['notification'] ); ?>><?php esc_html_e( 'User Lost Password - For User', 'bnfw' ); ?></option>
|
|
|
|
|
229 |
<option
|
230 |
value="password-changed" <?php selected( 'password-changed', $setting['notification'] ); ?>><?php esc_html_e( 'Password Changed - For User', 'bnfw' ); ?></option>
|
231 |
<option value="email-changing" <?php selected( 'email-changing', $setting['notification'] ); ?>>
|
235 |
value="email-changed" <?php selected( 'email-changed', $setting['notification'] ); ?>><?php esc_html_e( 'User Email Changed - For User', 'bnfw' ); ?></option>
|
236 |
<option
|
237 |
value="user-role" <?php selected( 'user-role', $setting['notification'] ); ?>><?php esc_html_e( 'User Role Changed - For User', 'bnfw' ); ?></option>
|
238 |
+
<option
|
239 |
+
value="user-login" <?php selected( 'user-login', $setting['notification'] ); ?>><?php esc_html_e( 'User Logged In - For User', 'bnfw' ); ?></option>
|
240 |
<option
|
241 |
value="reply-comment" <?php selected( 'reply-comment', $setting['notification'] ); ?>><?php esc_html_e( 'Comment Reply', 'bnfw' ); ?></option>
|
242 |
|
281 |
<option value="moderate-post-comment" <?php selected( 'moderate-post-comment', $setting['notification'] ); ?>>
|
282 |
<?php esc_html_e( 'New Comment Awaiting Moderation', 'bnfw' ); ?>
|
283 |
</option>
|
284 |
+
<option value="approve-post-comment" <?php selected( 'approve-post-comment', $setting['notification'] ); ?>>
|
285 |
+
<?php esc_html_e( 'Post - Comment Approved', 'bnfw' ); ?>
|
286 |
</option>
|
287 |
<option
|
288 |
value="newterm-category" <?php selected( 'newterm-category', $setting['notification'] ); ?>><?php esc_html_e( 'New Category', 'bnfw' ); ?></option>
|
312 |
<option value="moderate-page-comment" <?php selected( 'moderate-page-comment', $setting['notification'] ); ?>>
|
313 |
<?php esc_html_e( 'Page - New Comment Awaiting Moderation', 'bnfw' ); ?>
|
314 |
</option>
|
315 |
+
<option value="approve-page-comment" <?php selected( 'approve-page-comment', $setting['notification'] ); ?>>
|
316 |
+
<?php esc_html_e( 'Page - Comment Approved', 'bnfw' ); ?>
|
317 |
+
</option>
|
318 |
<option
|
319 |
value="commentreply-page" <?php selected( 'commentreply-page', $setting['notification'] ); ?>><?php esc_html_e( 'Page - Comment Reply', 'bnfw' ); ?></option>
|
320 |
<?php do_action( 'bnfw_after_notification_options', 'page', 'Page', $setting ); ?>
|
327 |
<option
|
328 |
value="update-media" <?php selected( 'update-media', $setting['notification'] ); ?>><?php esc_html_e( 'Media Updated', 'bnfw' ); ?></option>
|
329 |
<option
|
330 |
+
value="comment-attachment" <?php selected( 'comment-attachment', $setting['notification'] ); ?>><?php esc_html_e( 'Media - New Comment', 'bnfw' ); ?></option>
|
331 |
+
<option value="approve-attachment-comment" <?php selected( 'approve-attachment-comment', $setting['notification'] ); ?>>
|
332 |
+
<?php esc_html_e( 'Media - Comment Approved', 'bnfw' ); ?>
|
333 |
+
</option>
|
334 |
+
<option value="moderate-attachment-comment" <?php selected( 'moderate-attachment-comment', $setting['notification'] ); ?>>
|
335 |
+
<?php esc_html_e( 'Media - New Comment Awaiting Moderation', 'bnfw' ); ?></option>
|
336 |
+
<option
|
337 |
+
value="commentreply-attachment" <?php selected( 'commentreply-attachment', $setting['notification'] ); ?>><?php esc_html_e( 'Media - Comment Reply', 'bnfw' ); ?></option>
|
338 |
<?php do_action( 'bnfw_after_notification_options', 'media', 'Media', $setting ); ?>
|
339 |
</optgroup>
|
340 |
<?php do_action( 'bnfw_after_notification_options_optgroup', 'media', 'Media', $setting ); ?>
|
368 |
<option value="moderate-<?php echo esc_attr( $type ); ?>-comment" <?php selected( 'moderate-' . $type . '-comment', $setting['notification'] ); ?>>
|
369 |
<?php echo "'$label' - ", esc_html__( 'New Comment Awaiting Moderation', 'bnfw' ); ?>
|
370 |
</option>
|
371 |
+
<option value="approve-<?php echo esc_attr( $type ); ?>-comment" <?php selected( 'approve-' . $type . '-comment', $setting['notification'] ); ?>>
|
372 |
+
<?php echo "'$label' - ", esc_html__( 'Comment Approved', 'bnfw' ); ?>
|
373 |
+
</option>
|
374 |
<option
|
375 |
value="commentreply-<?php echo esc_attr( $type ); ?>" <?php selected( 'commentreply-' . $type, $setting['notification'] ); ?>><?php echo "'$label' ", esc_html__( 'Comment Reply', 'bnfw' ); ?></option>
|
376 |
<?php do_action( 'bnfw_after_notification_options', $type, $label, $setting ); ?>
|
1241 |
case 'new-comment':
|
1242 |
$name = esc_html__( 'New Comment', 'bnfw' );
|
1243 |
break;
|
1244 |
+
case 'approve-post-comment':
|
1245 |
+
$name = esc_html__( 'Post - Comment Approved', 'bnfw' );
|
1246 |
break;
|
1247 |
case 'moderate-comment':
|
1248 |
$name = esc_html__( 'New Comment Awaiting Moderation', 'bnfw' );
|
1352 |
case 'update-media':
|
1353 |
$name = esc_html__( 'Media Updated', 'bnfw' );
|
1354 |
break;
|
1355 |
+
case 'comment-attachment':
|
1356 |
$name = esc_html__( 'Media - New Comment', 'bnfw' );
|
1357 |
break;
|
1358 |
+
case 'approve-page-comment':
|
1359 |
+
$name = esc_html__( 'Page - Comment Approved', 'bnfw' );
|
1360 |
+
break;
|
1361 |
+
case 'approve-attachment-comment':
|
1362 |
+
$name = esc_html__( 'Media - Comment Approved', 'bnfw' );
|
1363 |
+
break;
|
1364 |
+
case 'moderate-attachment-comment':
|
1365 |
+
$name = esc_html__( 'Media - New Comment Awaiting Moderation', 'bnfw' );
|
1366 |
+
break;
|
1367 |
+
case 'commentreply-attachment':
|
1368 |
+
$name = esc_html__( 'Media - Comment Reply', 'bnfw' );
|
1369 |
+
break;
|
1370 |
|
1371 |
|
1372 |
default:
|
1403 |
case 'commentreply':
|
1404 |
$name = $label . esc_html__( ' Comment Reply', 'bnfw' );
|
1405 |
break;
|
1406 |
+
case 'approve':
|
1407 |
+
$name = $label . esc_html__( ' Comment Approved', 'bnfw' );
|
1408 |
+
break;
|
1409 |
case 'newterm':
|
1410 |
$tax = get_taxonomy( $splited[1] );
|
1411 |
if ( ! $tax ) {
|
includes/engine/class-bnfw-engine.php
CHANGED
@@ -492,7 +492,6 @@ class BNFW_Engine {
|
|
492 |
public function handle_shortcodes( $message, $notification, $extra_data ) {
|
493 |
switch ( $notification ) {
|
494 |
case 'new-comment':
|
495 |
-
case 'approve-comment':
|
496 |
case 'new-trackback':
|
497 |
case 'new-pingback':
|
498 |
case 'reply-comment':
|
@@ -589,6 +588,15 @@ class BNFW_Engine {
|
|
589 |
if ( 0 != $comment->user_id ) {
|
590 |
$message = $this->user_shortcodes( $message, $comment->user_id );
|
591 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
592 |
} elseif ( 'ca' === $type[0] ) {
|
593 |
$message = $this->confirm_action_shortcodes( $message, $extra_data );
|
594 |
$message = $this->handle_global_user_shortcodes( $message, $extra_data['email'] );
|
@@ -1078,6 +1086,12 @@ class BNFW_Engine {
|
|
1078 |
$post_id = $comment->comment_post_ID;
|
1079 |
}
|
1080 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1081 |
$post_author = get_post_field( 'post_author', $post_id );
|
1082 |
$author = get_user_by( 'id', $post_author );
|
1083 |
if ( false !== $author && $post_author != $exclude ) {
|
@@ -1086,6 +1100,7 @@ class BNFW_Engine {
|
|
1086 |
}
|
1087 |
}
|
1088 |
}
|
|
|
1089 |
|
1090 |
if ( 'true' == $setting['show-fields'] ) {
|
1091 |
$default_from_field = get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>';
|
492 |
public function handle_shortcodes( $message, $notification, $extra_data ) {
|
493 |
switch ( $notification ) {
|
494 |
case 'new-comment':
|
|
|
495 |
case 'new-trackback':
|
496 |
case 'new-pingback':
|
497 |
case 'reply-comment':
|
588 |
if ( 0 != $comment->user_id ) {
|
589 |
$message = $this->user_shortcodes( $message, $comment->user_id );
|
590 |
}
|
591 |
+
}elseif ( 'approve' === $type[0] ) {
|
592 |
+
// handle Approve comments notification
|
593 |
+
$message = $this->comment_shortcodes( $message, $extra_data );
|
594 |
+
$comment = get_comment( $extra_data );
|
595 |
+
$message = $this->post_shortcodes( $message, $comment->comment_post_ID );
|
596 |
+
if ( 0 != $comment->user_id ) {
|
597 |
+
$message = $this->user_shortcodes( $message, $comment->user_id );
|
598 |
+
}
|
599 |
+
break;
|
600 |
} elseif ( 'ca' === $type[0] ) {
|
601 |
$message = $this->confirm_action_shortcodes( $message, $extra_data );
|
602 |
$message = $this->handle_global_user_shortcodes( $message, $extra_data['email'] );
|
1086 |
$post_id = $comment->comment_post_ID;
|
1087 |
}
|
1088 |
|
1089 |
+
$type = explode( '-', $setting['notification'], 2 );
|
1090 |
+
if ('approve' == $type[0] ) {
|
1091 |
+
if ( ! in_array( $comment->comment_author_email, $emails['to'] ) ) {
|
1092 |
+
$emails['to'][] = $comment->comment_author_email;
|
1093 |
+
}
|
1094 |
+
}else{
|
1095 |
$post_author = get_post_field( 'post_author', $post_id );
|
1096 |
$author = get_user_by( 'id', $post_author );
|
1097 |
if ( false !== $author && $post_author != $exclude ) {
|
1100 |
}
|
1101 |
}
|
1102 |
}
|
1103 |
+
}
|
1104 |
|
1105 |
if ( 'true' == $setting['show-fields'] ) {
|
1106 |
$default_from_field = get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>';
|
includes/helpers/helpers.php
CHANGED
@@ -124,13 +124,12 @@ function bnfw_is_comment_notification( $notification_name ) {
|
|
124 |
case 'new-trackback':
|
125 |
case 'new-pingback':
|
126 |
case 'reply-comment':
|
127 |
-
case 'approve-comment':
|
128 |
$is_comment_notification = true;
|
129 |
break;
|
130 |
|
131 |
default:
|
132 |
$type = explode( '-', $notification_name, 2 );
|
133 |
-
if ( 'comment' == $type[0] || 'moderate' === $type[0] ) {
|
134 |
$is_comment_notification = true;
|
135 |
}
|
136 |
break;
|
124 |
case 'new-trackback':
|
125 |
case 'new-pingback':
|
126 |
case 'reply-comment':
|
|
|
127 |
$is_comment_notification = true;
|
128 |
break;
|
129 |
|
130 |
default:
|
131 |
$type = explode( '-', $notification_name, 2 );
|
132 |
+
if ( 'comment' == $type[0] || 'moderate' === $type[0] || 'approve' == $type[0] ) {
|
133 |
$is_comment_notification = true;
|
134 |
}
|
135 |
break;
|