Version Description
- 12th February 2016 =
- General bug fixes and updates relating to future add-ons and the new Per-post Override add-on which allows you to override your notifications for each post / page / custom post.
- Added: New Post Published notifications now trigger on
auto_draft_to_publish
. This may or may not effect you if you use a publish through a front-end form or from an app.
Download this release
Release Info
Developer | voltronik |
Plugin | Better Notifications for WordPress |
Version | 1.3.9.3 |
Comparing to | |
See all releases |
Code changes from version 1.3.9.2 to 1.3.9.3
- README.txt +11 -5
- bnfw.php +46 -7
- includes/engine/class-bnfw-engine.php +3 -3
README.txt
CHANGED
@@ -3,8 +3,8 @@ 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.4.
|
7 |
-
Stable tag: 1.3.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -14,13 +14,15 @@ Send customisable emails to your users for different WordPress notifications.
|
|
14 |
|
15 |
> New add-ons are now available! [Buy Add-ons](https://betternotificationsforwp.com/store/)
|
16 |
|
17 |
-
Better Notifications for WordPress allows you to
|
18 |
|
19 |
https://www.youtube.com/watch?v=MxPUyRZPJ1Q
|
20 |
|
21 |
= For example: =
|
22 |
You want a user with the editor role (or all users using the Editor role) to be alerted via email when a new post is published and you'd like to customise it to include your branding along with the author's display name and post time - with this plugin, that's easy.
|
23 |
|
|
|
|
|
24 |
> A handy list of shortcodes you can use is available [here](https://betternotificationsforwp.com/shortcodes/ "Shortcodes for use in Better Notifications for WordPress").
|
25 |
|
26 |
Notifications that are currently available to use are:
|
@@ -158,13 +160,13 @@ In order to fix a problem with P2 not triggering notifications at all, if you po
|
|
158 |
|
159 |
Try adding this code to your functions.php in your theme / child theme directory and replace `theme_name` with the name of your theme and re-test.
|
160 |
|
161 |
-
|
162 |
function bnfw_insert_post_hook_for_theme( $themes ) {
|
163 |
$themes[] = 'theme_name';
|
164 |
return $themes;
|
165 |
}
|
166 |
add_filter( 'bnfw_insert_post_themes', 'bnfw_insert_post_hook_for_theme' );
|
167 |
-
|
168 |
|
169 |
= Can I translate this plugin? =
|
170 |
|
@@ -188,6 +190,10 @@ An older version might work but this is untested. A lot of the newer features re
|
|
188 |
|
189 |
== Changelog ==
|
190 |
|
|
|
|
|
|
|
|
|
191 |
= 1.3.9.2 - 29th January 2016 =
|
192 |
* The [Add-on Store](https://betternotificationsforwp.com/store/) is now live! Looking for some extra, premium functionality in your notifications? You might find an add-on for it!
|
193 |
* New: A filter is now available for adding compatibility to themes for creating posts using `wp_insert_post`. Please see the bottom of the [FAQ](https://wordpress.org/plugins/bnfw/faq/) for details.
|
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.4.2
|
7 |
+
Stable tag: 1.3.9.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
14 |
|
15 |
> New add-ons are now available! [Buy Add-ons](https://betternotificationsforwp.com/store/)
|
16 |
|
17 |
+
Better Notifications for WordPress allows you to create custom email notifications and send them to user roles (including custom roles) or individual users for all kinds of things happening on your WordPress website. Emails are sent out via your WordPress website (using `wp_mail`) but can be sent via SMTP using an appropriate 3rd party plugin should you wish.
|
18 |
|
19 |
https://www.youtube.com/watch?v=MxPUyRZPJ1Q
|
20 |
|
21 |
= For example: =
|
22 |
You want a user with the editor role (or all users using the Editor role) to be alerted via email when a new post is published and you'd like to customise it to include your branding along with the author's display name and post time - with this plugin, that's easy.
|
23 |
|
24 |
+
If you want to override the notifications that you've set-up on an individual post / page / custom post basis, you may be interested in the [Per-post Override add-on](https://betternotificationsforwp.com/downloads/per-post-override/).
|
25 |
+
|
26 |
> A handy list of shortcodes you can use is available [here](https://betternotificationsforwp.com/shortcodes/ "Shortcodes for use in Better Notifications for WordPress").
|
27 |
|
28 |
Notifications that are currently available to use are:
|
160 |
|
161 |
Try adding this code to your functions.php in your theme / child theme directory and replace `theme_name` with the name of your theme and re-test.
|
162 |
|
163 |
+
`
|
164 |
function bnfw_insert_post_hook_for_theme( $themes ) {
|
165 |
$themes[] = 'theme_name';
|
166 |
return $themes;
|
167 |
}
|
168 |
add_filter( 'bnfw_insert_post_themes', 'bnfw_insert_post_hook_for_theme' );
|
169 |
+
`
|
170 |
|
171 |
= Can I translate this plugin? =
|
172 |
|
190 |
|
191 |
== Changelog ==
|
192 |
|
193 |
+
= 1.3.9.3 - 12th February 2016 =
|
194 |
+
* General bug fixes and updates relating to future add-ons and the new [Per-post Override add-on](https://betternotificationsforwp.com/downloads/per-post-override/) which allows you to override your notifications for each post / page / custom post.
|
195 |
+
* Added: New Post Published notifications now trigger on `auto_draft_to_publish`. This may or may not effect you if you use a publish through a front-end form or from an app.
|
196 |
+
|
197 |
= 1.3.9.2 - 29th January 2016 =
|
198 |
* The [Add-on Store](https://betternotificationsforwp.com/store/) is now live! Looking for some extra, premium functionality in your notifications? You might find an add-on for it!
|
199 |
* New: A filter is now available for adding compatibility to themes for creating posts using `wp_insert_post`. Please see the bottom of the [FAQ](https://wordpress.org/plugins/bnfw/faq/) for details.
|
bnfw.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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.9.
|
7 |
* Author: Voltronik
|
8 |
* Author URI: https://betternotificationsforwp.com/
|
9 |
* Author Email: plugins@voltronik.co.uk
|
@@ -115,6 +115,7 @@ class BNFW {
|
|
115 |
add_action( 'wp_insert_post' , array( $this, 'insert_post' ), 10, 3 );
|
116 |
}
|
117 |
|
|
|
118 |
add_action( 'draft_to_publish' , array( $this, 'publish_post' ) );
|
119 |
add_action( 'future_to_publish' , array( $this, 'publish_post' ) );
|
120 |
add_action( 'pending_to_publish' , array( $this, 'publish_post' ) );
|
@@ -136,6 +137,7 @@ class BNFW {
|
|
136 |
add_filter( 'retrieve_password_message' , array( $this, 'change_password_email_message' ), 10, 4 );
|
137 |
|
138 |
add_filter( 'plugin_action_links' , array( $this, 'plugin_action_links' ), 10, 4 );
|
|
|
139 |
}
|
140 |
|
141 |
/**
|
@@ -214,7 +216,7 @@ class BNFW {
|
|
214 |
$post_type = $post->post_type;
|
215 |
|
216 |
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
217 |
-
$this->
|
218 |
}
|
219 |
}
|
220 |
|
@@ -229,7 +231,7 @@ class BNFW {
|
|
229 |
$post_type = $post->post_type;
|
230 |
|
231 |
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
232 |
-
$this->
|
233 |
}
|
234 |
}
|
235 |
|
@@ -244,7 +246,7 @@ class BNFW {
|
|
244 |
$post_type = $post->post_type;
|
245 |
|
246 |
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
247 |
-
$this->
|
248 |
}
|
249 |
}
|
250 |
|
@@ -259,7 +261,7 @@ class BNFW {
|
|
259 |
$post_type = $post->post_type;
|
260 |
|
261 |
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
262 |
-
$this->
|
263 |
}
|
264 |
}
|
265 |
|
@@ -436,8 +438,8 @@ class BNFW {
|
|
436 |
*
|
437 |
* @access private
|
438 |
* @since 1.0
|
439 |
-
* @param
|
440 |
-
* @param
|
441 |
*/
|
442 |
private function send_notification( $type, $ref_id ) {
|
443 |
$notifications = $this->notifier->get_notifications( $type );
|
@@ -446,6 +448,26 @@ class BNFW {
|
|
446 |
}
|
447 |
}
|
448 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
449 |
/**
|
450 |
* Can send comment notification or not
|
451 |
*
|
@@ -461,6 +483,23 @@ class BNFW {
|
|
461 |
}
|
462 |
return true;
|
463 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
}
|
465 |
|
466 |
/* ------------------------------------------------------------------------ *
|
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.9.3
|
7 |
* Author: Voltronik
|
8 |
* Author URI: https://betternotificationsforwp.com/
|
9 |
* Author Email: plugins@voltronik.co.uk
|
115 |
add_action( 'wp_insert_post' , array( $this, 'insert_post' ), 10, 3 );
|
116 |
}
|
117 |
|
118 |
+
add_action( 'auto-draft_to_publish' , array( $this, 'publish_post' ) );
|
119 |
add_action( 'draft_to_publish' , array( $this, 'publish_post' ) );
|
120 |
add_action( 'future_to_publish' , array( $this, 'publish_post' ) );
|
121 |
add_action( 'pending_to_publish' , array( $this, 'publish_post' ) );
|
137 |
add_filter( 'retrieve_password_message' , array( $this, 'change_password_email_message' ), 10, 4 );
|
138 |
|
139 |
add_filter( 'plugin_action_links' , array( $this, 'plugin_action_links' ), 10, 4 );
|
140 |
+
add_action( 'shutdown' , array( $this, 'on_shutdown' ) );
|
141 |
}
|
142 |
|
143 |
/**
|
216 |
$post_type = $post->post_type;
|
217 |
|
218 |
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
219 |
+
$this->send_notification_async( 'new-' . $post_type, $post_id );
|
220 |
}
|
221 |
}
|
222 |
|
231 |
$post_type = $post->post_type;
|
232 |
|
233 |
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
234 |
+
$this->send_notification_async( 'update-' . $post_type, $post_id );
|
235 |
}
|
236 |
}
|
237 |
|
246 |
$post_type = $post->post_type;
|
247 |
|
248 |
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
249 |
+
$this->send_notification_async( 'pending-' . $post_type, $post_id );
|
250 |
}
|
251 |
}
|
252 |
|
261 |
$post_type = $post->post_type;
|
262 |
|
263 |
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
264 |
+
$this->send_notification_async( 'future-' . $post_type, $post_id );
|
265 |
}
|
266 |
}
|
267 |
|
438 |
*
|
439 |
* @access private
|
440 |
* @since 1.0
|
441 |
+
* @param string $type Notification type.
|
442 |
+
* @param int $ref_id Reference id.
|
443 |
*/
|
444 |
private function send_notification( $type, $ref_id ) {
|
445 |
$notifications = $this->notifier->get_notifications( $type );
|
448 |
}
|
449 |
}
|
450 |
|
451 |
+
/**
|
452 |
+
* Send notification async based on type and ref id.
|
453 |
+
*
|
454 |
+
* @access private
|
455 |
+
* @param string $type Notification type.
|
456 |
+
* @param int $ref_id Reference id.
|
457 |
+
*/
|
458 |
+
private function send_notification_async( $type, $ref_id ) {
|
459 |
+
$notifications = $this->notifier->get_notifications( $type );
|
460 |
+
foreach ( $notifications as $notification ) {
|
461 |
+
$transient = get_transient( 'bnfw-async-notifications' );
|
462 |
+
if ( ! is_array( $transient ) ) {
|
463 |
+
$transient = array();
|
464 |
+
}
|
465 |
+
|
466 |
+
$transient[] = array( 'ref_id' => $ref_id, 'notification_id' => $notification->ID, 'notification_type' => $type );
|
467 |
+
set_transient( 'bnfw-async-notifications', $transient, 600 );
|
468 |
+
}
|
469 |
+
}
|
470 |
+
|
471 |
/**
|
472 |
* Can send comment notification or not
|
473 |
*
|
483 |
}
|
484 |
return true;
|
485 |
}
|
486 |
+
|
487 |
+
/**
|
488 |
+
* Send notification emails on shutdown.
|
489 |
+
*/
|
490 |
+
public function on_shutdown() {
|
491 |
+
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
|
492 |
+
return;
|
493 |
+
}
|
494 |
+
|
495 |
+
$transient = get_transient( 'bnfw-async-notifications' );
|
496 |
+
if ( is_array( $transient ) ) {
|
497 |
+
foreach ( $transient as $id_pairs ) {
|
498 |
+
$this->engine->send_notification( $this->notifier->read_settings( $id_pairs['notification_id'] ), $id_pairs['ref_id'] );
|
499 |
+
}
|
500 |
+
delete_transient( 'bnfw-async-notifications' );
|
501 |
+
}
|
502 |
+
}
|
503 |
}
|
504 |
|
505 |
/* ------------------------------------------------------------------------ *
|
includes/engine/class-bnfw-engine.php
CHANGED
@@ -40,13 +40,13 @@ class BNFW_Engine {
|
|
40 |
*/
|
41 |
public function send_notification( $setting, $id ) {
|
42 |
/**
|
43 |
-
* BNFW - Whether notification is
|
44 |
*
|
45 |
* @since 1.3.6
|
46 |
*/
|
47 |
-
$
|
48 |
|
49 |
-
if ( $
|
50 |
$subject = $this->handle_shortcodes( $setting['subject'], $setting['notification'], $id );
|
51 |
$message = $this->handle_shortcodes( $setting['message'], $setting['notification'], $id );
|
52 |
$emails = $this->get_emails( $setting, $id );
|
40 |
*/
|
41 |
public function send_notification( $setting, $id ) {
|
42 |
/**
|
43 |
+
* BNFW - Whether notification is disabled?
|
44 |
*
|
45 |
* @since 1.3.6
|
46 |
*/
|
47 |
+
$notification_disabled = apply_filters( 'bnfw_notification_disabled', false, $id, $setting );
|
48 |
|
49 |
+
if ( ! $notification_disabled ) {
|
50 |
$subject = $this->handle_shortcodes( $setting['subject'], $setting['notification'], $id );
|
51 |
$message = $this->handle_shortcodes( $setting['message'], $setting['notification'], $id );
|
52 |
$emails = $this->get_emails( $setting, $id );
|