Version Description
- Lots of cool new stuff and more to come soon!
- Transactional notifications (notifications intended only for the end user) have been added as a new group in the notifications select box.
- New Notification: Post Pending Review (for all post types).
- New Notification: New User Registration (Transactional).
- New Notification: Password Reset (Transactional).
- New Notification: New User Welcome Email (Transactional).
- Added an option to enable or disable each notification.
- Better support for custom taxonomies and terms.
- Fixed: A few PHP warnings were showing when using
WP_DEBUG
. - Fixed: HTML tags being stripped from
[post_content]
and[comment_content]
. - Removed: Some WordPress Multisite shortcodes that didn't work properly. Proper support for Multisite will come later.
- If you liked this plugin, please leave a 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 | Better Notifications for WordPress |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.1
- README.txt +53 -20
- assets/images/notification-enabled.png +0 -0
- assets/js/bnfw.js +38 -0
- bnfw.php +341 -246
- includes/admin/bnfw-settings.php +59 -208
- includes/admin/class-bnfw-notification.php +562 -497
- includes/debug.php +0 -21
- includes/engine/class-bnfw-engine.php +365 -275
- includes/import.php +137 -133
- includes/overrides.php +43 -39
- languages/bnfw.pot +168 -91
README.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: voltronik
|
3 |
Tags: notifications, email, alerts, roles, users, HTML
|
4 |
Requires at least: 3.5
|
5 |
-
Tested up to: 4.1
|
6 |
-
Stable tag: 1.
|
7 |
-
License:
|
8 |
|
9 |
Send customisable HTML emails to your users for different WordPress notifications.
|
10 |
|
@@ -19,19 +19,38 @@ You want a user with the editor role (or all users using the Editor role) to be
|
|
19 |
|
20 |
Notifications that are currently available to use are:
|
21 |
|
22 |
-
|
23 |
-
|
24 |
-
*
|
25 |
-
* New
|
26 |
-
* New
|
27 |
-
*
|
28 |
-
* New
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
If you'd like to see a notification in the list above, please drop me a line in the forums and we'll see what we can do to add it.
|
33 |
|
34 |
-
A long and handy list of shortcodes you can use is available [here](http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/ "Shortcodes for use in Better Notifications for WordPress").
|
35 |
|
36 |
|
37 |
Having problems? Please let me know via this plugin's forum so we can address them and let it act as a source of information for future reference and other users.
|
@@ -49,7 +68,7 @@ Don't think the plugin is worthy of 5 stars? Let me know on the forum and we'll
|
|
49 |
1. Upload the 'bnfw' plugin folder to the '/wp-content/plugins/' directory or download it via your WordPress installation.
|
50 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
51 |
3. Use the settings in the new 'Notifications' Menu item in the sidebar to configure the plugin.
|
52 |
-
4. (Optional) Install a plugin to use SMTP instead of wp_mail()
|
53 |
5. Test by creating a notification.
|
54 |
|
55 |
|
@@ -60,16 +79,16 @@ Don't think the plugin is worthy of 5 stars? Let me know on the forum and we'll
|
|
60 |
|
61 |
Shortcodes are little blocks of content inserted by WordPress, contained in square brackets. For example, if you want to add the content of a post to a notification for 'New Post Published', you can use the `[post_content]` shortcode to display this in the email that is sent out.
|
62 |
|
63 |
-
Shortcodes can be used in the 'Subject' and 'Message Body' of your notifications.
|
64 |
|
65 |
-
A long and handy list of shortcodes you can use is available [here](http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/ "Shortcodes for use in Better Notifications for WordPress").
|
66 |
|
67 |
= What are some scenarios this plugin could be used for? =
|
68 |
|
69 |
* Outreach: A blog/news site with hundreds of subscribers and want to use it to alert them of new blog posts.
|
70 |
-
* Communication: A small, internal WordPress site and use it to alert staff of new comments.
|
71 |
* Monitor: A website for an awesome new product or service and use it for notifications of pingbacks and trackbacks.
|
72 |
-
* Security: To receive alerts of password reset requests and their corresponding
|
73 |
|
74 |
The possibilities are endless!
|
75 |
|
@@ -95,7 +114,7 @@ Many hosts place a limit on the number of emails that can be sent out within an
|
|
95 |
|
96 |
= Some of my shortcodes aren't working! =
|
97 |
|
98 |
-
It's possible you're inserting a shortcode into a notification that cannot use it. For example: the 'New Category' email notification cannot use any of the author or time shortcodes as WordPress only stores the category name, category slug and category description in the database. It's also worth checking the spelling and hyphens in any shortcodes as well as if they are wrapped in square brackets
|
99 |
|
100 |
= Can I translate this plugin? =
|
101 |
|
@@ -119,8 +138,22 @@ It might do but this is untested.
|
|
119 |
|
120 |
== Changelog ==
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
= 1.0.2 =
|
123 |
-
* Bug fix for [ID] shortcode not outputting anything.
|
124 |
* Bug fix for `[post_category]` showing as empty.
|
125 |
* Added tags shortcode for use in certain notifications using `[post_tag]`.
|
126 |
|
2 |
Contributors: voltronik
|
3 |
Tags: notifications, email, alerts, roles, users, HTML
|
4 |
Requires at least: 3.5
|
5 |
+
Tested up to: 4.1.1
|
6 |
+
Stable tag: 1.1
|
7 |
+
License: GPLv2 or later
|
8 |
|
9 |
Send customisable HTML emails to your users for different WordPress notifications.
|
10 |
|
19 |
|
20 |
Notifications that are currently available to use are:
|
21 |
|
22 |
+
**WordPress Defaults**
|
23 |
+
|
24 |
+
* New Comment / Comment Awaiting Moderation
|
25 |
+
* New Trackback
|
26 |
+
* New Pingback
|
27 |
+
* Lost Password (For Admin)
|
28 |
+
* New User Registration (For Admin)
|
29 |
+
|
30 |
+
**Transactional**
|
31 |
+
|
32 |
+
* Lost Password (For User)
|
33 |
+
* New User Registration (For User)
|
34 |
+
* New User - Welcome Email
|
35 |
+
|
36 |
+
**Posts / Custom Post Types**
|
37 |
+
|
38 |
+
* New Post Published
|
39 |
+
* Post Updated
|
40 |
+
* Post Pending Review
|
41 |
+
|
42 |
+
**Posts**
|
43 |
+
|
44 |
+
* New Category
|
45 |
+
* New Tag
|
46 |
+
|
47 |
+
**Custom Post Types**
|
48 |
+
|
49 |
+
* New Taxonomy / Term
|
50 |
|
51 |
If you'd like to see a notification in the list above, please drop me a line in the forums and we'll see what we can do to add it.
|
52 |
|
53 |
+
> A long and handy list of shortcodes you can use is available [here](http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/ "Shortcodes for use in Better Notifications for WordPress").
|
54 |
|
55 |
|
56 |
Having problems? Please let me know via this plugin's forum so we can address them and let it act as a source of information for future reference and other users.
|
68 |
1. Upload the 'bnfw' plugin folder to the '/wp-content/plugins/' directory or download it via your WordPress installation.
|
69 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
70 |
3. Use the settings in the new 'Notifications' Menu item in the sidebar to configure the plugin.
|
71 |
+
4. (Optional) Install a plugin to use SMTP instead of `wp_mail()`. We recommend WP-Mail-SMTP.
|
72 |
5. Test by creating a notification.
|
73 |
|
74 |
|
79 |
|
80 |
Shortcodes are little blocks of content inserted by WordPress, contained in square brackets. For example, if you want to add the content of a post to a notification for 'New Post Published', you can use the `[post_content]` shortcode to display this in the email that is sent out.
|
81 |
|
82 |
+
Shortcodes can be used in the 'Subject' and 'Message Body' of your notifications, except for a select few (due to a restriction in WordPress).
|
83 |
|
84 |
+
> A long and handy list of shortcodes you can use is available [here](http://www.voltronik.co.uk/wordpress-plugins/better-notifications-for-wordpress/ "Shortcodes for use in Better Notifications for WordPress").
|
85 |
|
86 |
= What are some scenarios this plugin could be used for? =
|
87 |
|
88 |
* Outreach: A blog/news site with hundreds of subscribers and want to use it to alert them of new blog posts.
|
89 |
+
* Communication: A small, internal WordPress site and use it to alert staff of new posts or comments.
|
90 |
* Monitor: A website for an awesome new product or service and use it for notifications of pingbacks and trackbacks.
|
91 |
+
* Security: To receive alerts of password reset requests and their corresponding user.
|
92 |
|
93 |
The possibilities are endless!
|
94 |
|
114 |
|
115 |
= Some of my shortcodes aren't working! =
|
116 |
|
117 |
+
It's possible you're inserting a shortcode into a notification that cannot use it. For example: the 'New Category' email notification cannot use any of the author or time shortcodes as WordPress only stores the category name, category slug and category description in the database. It's also worth checking the spelling and hyphens in any shortcodes as well as if they are wrapped in square brackets `[]`.
|
118 |
|
119 |
= Can I translate this plugin? =
|
120 |
|
138 |
|
139 |
== Changelog ==
|
140 |
|
141 |
+
= 1.1 =
|
142 |
+
* Lots of cool new stuff and more to come soon!
|
143 |
+
* Transactional notifications (notifications intended only for the end user) have been added as a new group in the notifications select box.
|
144 |
+
* New Notification: Post Pending Review (for all post types).
|
145 |
+
* New Notification: New User Registration (Transactional).
|
146 |
+
* New Notification: Password Reset (Transactional).
|
147 |
+
* New Notification: New User Welcome Email (Transactional).
|
148 |
+
* Added an option to enable or disable each notification.
|
149 |
+
* Better support for custom taxonomies and terms.
|
150 |
+
* Fixed: A few PHP warnings were showing when using `WP_DEBUG`.
|
151 |
+
* Fixed: HTML tags being stripped from `[post_content]` and `[comment_content]`.
|
152 |
+
* Removed: Some WordPress Multisite shortcodes that didn't work properly. Proper support for Multisite will come later.
|
153 |
+
* If you liked this plugin, please leave a review. If you didn't or have a problem, please send me a message in the Support Forum.
|
154 |
+
|
155 |
= 1.0.2 =
|
156 |
+
* Bug fix for `[ID]` shortcode not outputting anything.
|
157 |
* Bug fix for `[post_category]` showing as empty.
|
158 |
* Added tags shortcode for use in certain notifications using `[post_tag]`.
|
159 |
|
assets/images/notification-enabled.png
ADDED
Binary file
|
assets/js/bnfw.js
CHANGED
@@ -1,5 +1,43 @@
|
|
1 |
jQuery(document).ready(function($) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
$(".select2").select2();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
$("#bnfw_user_role_toggle, #bnfw_user_toggle").click(function() {
|
5 |
$("#bnfw_user_role_container").toggle();
|
1 |
jQuery(document).ready(function($) {
|
2 |
+
function toggle_fields() {
|
3 |
+
var show_fields = $('#show-fields').is(":checked");
|
4 |
+
|
5 |
+
if ( show_fields ) {
|
6 |
+
$('#email, #cc, #bcc').show();
|
7 |
+
} else {
|
8 |
+
$('#email, #cc, #bcc').hide();
|
9 |
+
}
|
10 |
+
}
|
11 |
+
|
12 |
$(".select2").select2();
|
13 |
+
//toggle_fields();
|
14 |
+
|
15 |
+
if ( 'user-password' == $('#notification').val() || 'new-user' == $('#notification').val() || 'welcome-email' == $('#notification').val() ) {
|
16 |
+
//$('#toggle-fields, #email, #cc, #bcc, #user-role').hide();
|
17 |
+
$('#toggle-fields, #user-role').hide();
|
18 |
+
$('#user-password-msg').show();
|
19 |
+
} else {
|
20 |
+
$('#toggle-fields, #user-role').show();
|
21 |
+
//toggle_fields();
|
22 |
+
$('#user-password-msg').hide();
|
23 |
+
}
|
24 |
+
|
25 |
+
$('#notification').on('change', function() {
|
26 |
+
var $this = $(this);
|
27 |
+
if ( 'user-password' === $this.val() || 'new-user' === $this.val() || 'welcome-email' == $this.val() ) {
|
28 |
+
//$('#toggle-fields, #email, #cc, #bcc, #user-role').hide();
|
29 |
+
$('#toggle-fields, #user-role').hide();
|
30 |
+
$('#user-password-msg').show();
|
31 |
+
} else {
|
32 |
+
$('#toggle-fields, #user-role').show();
|
33 |
+
$('#user-password-msg').hide();
|
34 |
+
//toggle_fields();
|
35 |
+
}
|
36 |
+
});
|
37 |
+
|
38 |
+
//$('#show-fields').change(function() {
|
39 |
+
//toggle_fields();
|
40 |
+
//});
|
41 |
|
42 |
$("#bnfw_user_role_toggle, #bnfw_user_toggle").click(function() {
|
43 |
$("#bnfw_user_role_container").toggle();
|
bnfw.php
CHANGED
@@ -1,257 +1,352 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
Plugin Name: Better Notifications for WordPress
|
4 |
-
Plugin URI: http://wordpress.org/plugins/bnfw/
|
5 |
-
Description: Send customisable HTML emails to your users for different WordPress notifications.
|
6 |
-
Version: 1.
|
7 |
-
Author: Voltronik
|
8 |
-
Author URI: http://www.voltronik.co.uk/
|
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 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
along with this program; if not, write to the Free Software
|
30 |
-
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
31 |
-
*/
|
32 |
-
|
33 |
class BNFW {
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
}
|
253 |
|
254 |
/* ------------------------------------------------------------------------ *
|
255 |
* Fire up the plugin
|
256 |
* ------------------------------------------------------------------------ */
|
257 |
-
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Plugin Name: Better Notifications for WordPress
|
4 |
+
* Plugin URI: http://wordpress.org/plugins/bnfw/
|
5 |
+
* Description: Send customisable HTML emails to your users for different WordPress notifications.
|
6 |
+
* Version: 1.1
|
7 |
+
* Author: Voltronik
|
8 |
+
* Author URI: http://www.voltronik.co.uk/
|
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.
|
21 |
+
* This program is distributed in the hope that it will be useful,
|
22 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
23 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
24 |
+
* GNU General Public License for more details.
|
25 |
+
* You should have received a copy of the GNU General Public License
|
26 |
+
* along with this program; if not, write to the Free Software
|
27 |
+
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
28 |
+
*/
|
|
|
|
|
|
|
|
|
29 |
class BNFW {
|
30 |
|
31 |
+
/**
|
32 |
+
* Constructor.
|
33 |
+
*
|
34 |
+
* @since 1.0
|
35 |
+
*/
|
36 |
+
function __construct() {
|
37 |
+
$this->load_textdomain();
|
38 |
+
$this->includes();
|
39 |
+
$this->hooks();
|
40 |
+
|
41 |
+
$this->notifier = new BNFW_Notification;
|
42 |
+
$this->engine = new BNFW_Engine;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Factory method to return the instance of the class.
|
47 |
+
*
|
48 |
+
* Makes sure that only one instance is created.
|
49 |
+
*
|
50 |
+
* @return object Instance of the class
|
51 |
+
*/
|
52 |
+
public static function factory() {
|
53 |
+
static $instance = false;
|
54 |
+
if ( ! $instance ) {
|
55 |
+
$instance = new self();
|
56 |
+
}
|
57 |
+
return $instance;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Loads the plugin language files
|
62 |
+
*
|
63 |
+
* @since 1.0
|
64 |
+
*/
|
65 |
+
public function load_textdomain() {
|
66 |
+
// Load localization domain
|
67 |
+
$this->translations = dirname( plugin_basename( __FILE__ ) ) . '/languages/';
|
68 |
+
load_plugin_textdomain( 'bnfw', false, $this->translations );
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Include required files.
|
73 |
+
*
|
74 |
+
* @since 1.0
|
75 |
+
*/
|
76 |
+
public function includes() {
|
77 |
+
// Load Engine and post type
|
78 |
+
require_once 'includes/engine/class-bnfw-engine.php';
|
79 |
+
require_once 'includes/admin/class-bnfw-notification.php';
|
80 |
+
require_once 'includes/overrides.php';
|
81 |
+
|
82 |
+
// Load Admin Pages
|
83 |
+
if ( is_admin() ) {
|
84 |
+
require_once 'includes/admin/bnfw-settings.php';
|
85 |
+
}
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Register Hooks.
|
90 |
+
*
|
91 |
+
* @since 1.0
|
92 |
+
*/
|
93 |
+
public function hooks() {
|
94 |
+
register_activation_hook( __FILE__ , array( $this, 'activate' ) );
|
95 |
+
|
96 |
+
add_action( 'draft_to_publish' , array( $this, 'publish_post' ) );
|
97 |
+
add_action( 'publish_to_publish' , array( $this, 'update_post' ) );
|
98 |
+
|
99 |
+
add_action( 'draft_to_pending' , array( $this, 'pending_post' ) );
|
100 |
+
add_action( 'new_to_pending' , array( $this, 'pending_post' ) );
|
101 |
+
add_action( 'auto-draft_to_pending' , array( $this, 'pending_post' ) );
|
102 |
+
|
103 |
+
add_action( 'comment_post' , array( $this, 'comment_post' ) );
|
104 |
+
add_action( 'trackback_post' , array( $this, 'trackback_post' ) );
|
105 |
+
add_action( 'pingback_post' , array( $this, 'pingback_post' ) );
|
106 |
+
|
107 |
+
add_action( 'user_register' , array( $this, 'user_register' ) );
|
108 |
+
add_action( 'user_register' , array( $this, 'welcome_email' ) );
|
109 |
+
|
110 |
+
add_action( 'lostpassword_post' , array( $this, 'on_lost_password' ) );
|
111 |
+
add_filter( 'retrieve_password_title' , array( $this, 'change_password_email_title' ) );
|
112 |
+
add_filter( 'retrieve_password_message' , array( $this, 'change_password_email_message' ), 10, 4 );
|
113 |
+
|
114 |
+
add_action( 'create_term' , array( $this, 'create_term' ), 10, 3 );
|
115 |
+
|
116 |
+
add_filter( 'plugin_action_links' , array( $this, 'plugin_action_links' ), 10, 4 );
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Run this on first-time plugin activation
|
121 |
+
*
|
122 |
+
* @since 1.0
|
123 |
+
*/
|
124 |
+
|
125 |
+
/**
|
126 |
+
* importer
|
127 |
+
*/
|
128 |
+
public function activate() {
|
129 |
+
require_once dirname( __FILE__ ) . '/includes/import.php';
|
130 |
+
$importer = new BNFW_Import;
|
131 |
+
$importer->import();
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* Add 'Settings' link below BNFW in Plugins list.
|
136 |
+
*
|
137 |
+
* @since 1.0
|
138 |
+
* @param unknown $links
|
139 |
+
* @param unknown $file
|
140 |
+
* @return unknown
|
141 |
+
*/
|
142 |
+
public function plugin_action_links( $links, $file ) {
|
143 |
+
$plugin_file = 'bnfw/bnfw.php';
|
144 |
+
if ( $file == $plugin_file ) {
|
145 |
+
$settings_link = '<a href="' . admin_url( 'admin.php?page=bnfw-settings' ) . '">' . 'Settings' . '</a>';
|
146 |
+
array_unshift( $links, $settings_link );
|
147 |
+
}
|
148 |
+
return $links;
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* When a new term is created.
|
153 |
+
*
|
154 |
+
* @since 1.0
|
155 |
+
* @param int $term_id
|
156 |
+
* @param int $tt_id
|
157 |
+
* @param string $taxonomy
|
158 |
+
*/
|
159 |
+
public function create_term( $term_id, $tt_id, $taxonomy ) {
|
160 |
+
$this->send_notification( 'new-' . $taxonomy, $term_id );
|
161 |
+
}
|
162 |
+
|
163 |
+
/**
|
164 |
+
* Fires when a post is created for the first time.
|
165 |
+
*
|
166 |
+
* @since 1.0
|
167 |
+
* @param unknown $post
|
168 |
+
*/
|
169 |
+
function publish_post( $post ) {
|
170 |
+
$post_id = $post->ID;
|
171 |
+
$post_type = $post->post_type;
|
172 |
+
|
173 |
+
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
174 |
+
$this->send_notification( 'new-' . $post_type, $post_id );
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Fires when a post is updated.
|
180 |
+
*
|
181 |
+
* @since 1.0
|
182 |
+
* @param unknown $post
|
183 |
+
*/
|
184 |
+
function update_post( $post ) {
|
185 |
+
$post_id = $post->ID;
|
186 |
+
$post_type = $post->post_type;
|
187 |
+
|
188 |
+
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
189 |
+
$this->send_notification( 'update-' . $post_type, $post_id );
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Fires when a post is pending for review.
|
195 |
+
*
|
196 |
+
* @since 1.1
|
197 |
+
* @param unknown $post
|
198 |
+
*/
|
199 |
+
function pending_post( $post ) {
|
200 |
+
$post_id = $post->ID;
|
201 |
+
$post_type = $post->post_type;
|
202 |
+
|
203 |
+
if ( BNFW_Notification::POST_TYPE != $post_type ) {
|
204 |
+
$this->send_notification( 'pending-' . $post_type, $post_id );
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
/**
|
209 |
+
* Send notification for new comments
|
210 |
+
*
|
211 |
+
* @since 1.0
|
212 |
+
* @param unknown $comment_id
|
213 |
+
*/
|
214 |
+
function comment_post( $comment_id ) {
|
215 |
+
$the_comment = get_comment( $comment_id );
|
216 |
+
if ( $this->can_send_comment_notification( $the_comment ) ) {
|
217 |
+
$this->send_notification( 'new-comment', $comment_id );
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Send notification for new trackback
|
223 |
+
*
|
224 |
+
* @since 1.0
|
225 |
+
* @param unknown $comment_id
|
226 |
+
*/
|
227 |
+
function trackback_post( $comment_id ) {
|
228 |
+
$the_comment = get_comment( $comment_id );
|
229 |
+
if ( $this->can_send_comment_notification( $the_comment ) ) {
|
230 |
+
$this->send_notification( 'new-trackback', $comment_id );
|
231 |
+
}
|
232 |
+
}
|
233 |
+
|
234 |
+
/**
|
235 |
+
* Send notification for new pingbacks
|
236 |
+
*
|
237 |
+
* @since 1.0
|
238 |
+
* @param unknown $comment_id
|
239 |
+
*/
|
240 |
+
function pingback_post( $comment_id ) {
|
241 |
+
$the_comment = get_comment( $comment_id );
|
242 |
+
if ( $this->can_send_comment_notification( $the_comment ) ) {
|
243 |
+
$this->send_notification( 'new-pingback', $comment_id );
|
244 |
+
}
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
* Send notification for lost password.
|
249 |
+
*
|
250 |
+
* @since 1.0
|
251 |
+
*/
|
252 |
+
function on_lost_password() {
|
253 |
+
$user = get_user_by( 'login', trim( $_POST['user_login'] ) );
|
254 |
+
if ( $user ) {
|
255 |
+
$this->send_notification( 'admin-password', $user->ID );
|
256 |
+
}
|
257 |
+
}
|
258 |
+
|
259 |
+
/**
|
260 |
+
* Change the title of the password reset email that is sent to the user.
|
261 |
+
*
|
262 |
+
* @since 1.1
|
263 |
+
*/
|
264 |
+
public function change_password_email_title( $title ) {
|
265 |
+
$notifications = $this->notifier->get_notifications( 'user-password' );
|
266 |
+
if ( count( $notifications ) > 0 ) {
|
267 |
+
// Ideally there should be only one notification for this type.
|
268 |
+
// If there are multiple notification then we will read data about only the last one
|
269 |
+
$setting = $this->notifier->read_settings( end( $notifications )->ID );
|
270 |
+
return $setting['subject'];
|
271 |
+
}
|
272 |
+
|
273 |
+
return $title;
|
274 |
+
}
|
275 |
+
|
276 |
+
/**
|
277 |
+
* Change the message of the password reset email.
|
278 |
+
*
|
279 |
+
* @since 1.1
|
280 |
+
*/
|
281 |
+
public function change_password_email_message( $message, $key, $user_login, $user_data ) {
|
282 |
+
$notifications = $this->notifier->get_notifications( 'user-password' );
|
283 |
+
if ( count( $notifications ) > 0 ) {
|
284 |
+
// Ideally there should be only one notification for this type.
|
285 |
+
// If there are multiple notification then we will read data about only the last one
|
286 |
+
$setting = $this->notifier->read_settings( end( $notifications )->ID );
|
287 |
+
|
288 |
+
return $this->engine->handle_password_reset_shortcodes( $setting, $key, $user_login, $user_data );
|
289 |
+
}
|
290 |
+
|
291 |
+
return $message;
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Send notification for new uses.
|
296 |
+
*
|
297 |
+
* @since 1.0
|
298 |
+
* @param unknown $user_id
|
299 |
+
*/
|
300 |
+
function user_register( $user_id ) {
|
301 |
+
$this->send_notification( 'admin-user', $user_id );
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* New User - Welcome email
|
306 |
+
*
|
307 |
+
* @since 1.1
|
308 |
+
* @param int $user_id New user id
|
309 |
+
*/
|
310 |
+
function welcome_email( $user_id ) {
|
311 |
+
$notifications = $this->notifier->get_notifications( 'welcome-email' );
|
312 |
+
foreach ( $notifications as $notification ) {
|
313 |
+
$this->engine->send_registration_email( $this->notifier->read_settings( $notification->ID ), get_userdata( $user_id ) );
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Send notification based on type and ref id
|
319 |
+
*
|
320 |
+
* @access private
|
321 |
+
* @since 1.0
|
322 |
+
* @param unknown $type
|
323 |
+
* @param unknown $ref_id
|
324 |
+
*/
|
325 |
+
private function send_notification( $type, $ref_id ) {
|
326 |
+
$notifications = $this->notifier->get_notifications( $type );
|
327 |
+
foreach ( $notifications as $notification ) {
|
328 |
+
$this->engine->send_notification( $this->notifier->read_settings( $notification->ID ), $ref_id );
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
/**
|
333 |
+
* Can send comment notification or not
|
334 |
+
*
|
335 |
+
* @since 1.0
|
336 |
+
* @param unknown $comment
|
337 |
+
* @return unknown
|
338 |
+
*/
|
339 |
+
private function can_send_comment_notification( $comment ) {
|
340 |
+
// Returns false if the comment is marked as spam AND admin has enabled suppression of spam
|
341 |
+
$suppress_spam = get_option( 'bnfw_suppress_spam' );
|
342 |
+
if ( '1' === $suppress_spam && ( 0 === strcmp( $comment->comment_approved, 'spam' ) ) ) {
|
343 |
+
return false;
|
344 |
+
}
|
345 |
+
return true;
|
346 |
+
}
|
347 |
}
|
348 |
|
349 |
/* ------------------------------------------------------------------------ *
|
350 |
* Fire up the plugin
|
351 |
* ------------------------------------------------------------------------ */
|
352 |
+
BNFW::factory();
|
includes/admin/bnfw-settings.php
CHANGED
@@ -1,20 +1,22 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
* Register the Admin pages and load the scripts action
|
4 |
-
|
5 |
|
6 |
-
|
|
|
|
|
7 |
function bnfw_admin_menu() {
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
}
|
19 |
// Add the Admin pages to the WordPress menu
|
20 |
add_action( 'admin_menu', 'bnfw_admin_menu' );
|
@@ -23,22 +25,24 @@ add_action( 'admin_menu', 'bnfw_admin_menu' );
|
|
23 |
* Menu Pages
|
24 |
* ------------------------------------------------------------------------ */
|
25 |
|
26 |
-
|
|
|
|
|
27 |
function bnfw_settings_page() {
|
28 |
-
|
29 |
|
30 |
<div class="wrap">
|
31 |
<?php screen_icon(); ?>
|
32 |
-
<h2><?php _e( 'BNFW Settings', 'bnfw'); ?></h2>
|
33 |
|
34 |
<form method="post" action="options.php" class="bnfw-form">
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
40 |
-
|
41 |
-
|
42 |
</form>
|
43 |
</div>
|
44 |
|
@@ -48,89 +52,58 @@ function bnfw_settings_page() {
|
|
48 |
/* ------------------------------------------------------------------------ *
|
49 |
* Settings Page - Setting Registration
|
50 |
* ------------------------------------------------------------------------ */
|
51 |
-
function bnfw_general_options() {
|
52 |
-
|
53 |
-
// Set-up - General Options Section
|
54 |
-
add_settings_section (
|
55 |
-
'bnfw_general_options_section', // Section ID
|
56 |
-
'', // Title above settings section
|
57 |
-
'bnfw_general_options_callback', // Name of function that renders a description of the settings section
|
58 |
-
'bnfw-settings' // Page to show on
|
59 |
-
);
|
60 |
-
|
61 |
-
// Add - Specify Name, Email, CC and BCC Checkbox
|
62 |
-
//add_settings_field (
|
63 |
-
//'bnfw_specify_email_headers', // Field ID
|
64 |
-
//__( 'Email Headers', 'bnfw' ), // Label to the left
|
65 |
-
//'bnfw_general_options_section_checkbox', // Name of function that renders options on the page
|
66 |
-
//'bnfw-settings', // Page to show on
|
67 |
-
//'bnfw_general_options_section', // Associate with which settings section?
|
68 |
-
//array(
|
69 |
-
//__( 'Do you want to specify a Name, Email, CC and BCC for each notification?', 'bnfw' )
|
70 |
-
//)
|
71 |
-
//);
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
'bnfw_suppress_spam_checkbox', // Name of function that renders options on the page
|
78 |
-
'bnfw-settings', // Page to show on
|
79 |
-
'bnfw_general_options_section', // Associate with which settings section?
|
80 |
-
array(
|
81 |
-
__( "Don't send notifications for comments marked as SPAM by Akismet", 'bnfw' )
|
82 |
-
)
|
83 |
-
);
|
84 |
-
|
85 |
-
//// Add - Minimum access role dropdown
|
86 |
-
//add_settings_field (
|
87 |
-
//'bnfw_choose_admin', // Field ID
|
88 |
-
//__( 'Set minimum role to have access to this plugin', 'bnfw' ), // Label to the left
|
89 |
-
//'bnfw_choose_admin_dropdown', // Name of function that renders options on the page
|
90 |
-
//'bnfw-settings', // Page to show on
|
91 |
-
//'bnfw_general_options_section' // Associate with which settings section?
|
92 |
-
//);
|
93 |
-
|
94 |
-
// Register - Specify Name, Email, CC and BCC Checkbox
|
95 |
-
//register_setting (
|
96 |
-
//'bnfw-settings',
|
97 |
-
//'bnfw_specify_email_headers'
|
98 |
-
//);
|
99 |
-
|
100 |
-
// Register - Suppress SPAM Checkbox
|
101 |
-
register_setting (
|
102 |
-
'bnfw-settings',
|
103 |
-
'bnfw_suppress_spam'
|
104 |
-
);
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
}
|
112 |
-
add_action('admin_init', 'bnfw_general_options');
|
113 |
|
114 |
/* ------------------------------------------------------------------------ *
|
115 |
* Settings Page - Settings Section Callbacks
|
116 |
* ------------------------------------------------------------------------ */
|
117 |
|
|
|
|
|
|
|
118 |
function bnfw_general_options_callback() {}
|
119 |
|
120 |
/* ------------------------------------------------------------------------ *
|
121 |
* Settings Page - Settings Field Callbacks
|
122 |
* ------------------------------------------------------------------------ */
|
123 |
|
124 |
-
// Specify Name, Email, CC and BCC Checkbox
|
125 |
-
function bnfw_general_options_section_checkbox($args) {
|
126 |
-
echo '<input type="checkbox" id="bnfw_specify_email_headers" name="bnfw_specify_email_headers" value="1" ' . checked(1, get_option('bnfw_specify_email_headers'), false) . '/>';
|
127 |
-
echo '<label for="bnfw_specify_email_headers"> ' . $args[0] . '</label>';
|
128 |
-
}
|
129 |
-
|
130 |
/**
|
131 |
* Suppress SPAM checkbox.
|
132 |
*
|
133 |
* @since 1.0
|
|
|
134 |
*/
|
135 |
function bnfw_suppress_spam_checkbox( $args ) {
|
136 |
?>
|
@@ -138,125 +111,3 @@ function bnfw_suppress_spam_checkbox( $args ) {
|
|
138 |
<label for="bnfw_suppress_spam"><?php echo $args[0]; ?></label>
|
139 |
<?php
|
140 |
}
|
141 |
-
|
142 |
-
// Minimum access role dropdown
|
143 |
-
function bnfw_choose_admin_dropdown($args) {
|
144 |
-
|
145 |
-
echo '<select id="bnfw_choose_admin" name="bnfw_choose_admin">';
|
146 |
-
global $wp_roles;
|
147 |
-
$roles = $wp_roles->get_names();
|
148 |
-
|
149 |
-
foreach($roles as $role) {
|
150 |
-
echo '<option value="'.$role.'"' . selected(get_option('bnfw_choose_admin'), $role , false) . '>' . $role . '</option>';
|
151 |
-
}
|
152 |
-
echo '</select>';
|
153 |
-
}
|
154 |
-
|
155 |
-
/* ------------------------------------------------------------------------ *
|
156 |
-
* Notification Generator - Setting Registration
|
157 |
-
* ------------------------------------------------------------------------ */
|
158 |
-
function bnfw_generator_options() {
|
159 |
-
|
160 |
-
// Set-up - Generator Section
|
161 |
-
add_settings_section (
|
162 |
-
'bnfw_generator_section', // Section ID
|
163 |
-
'', // Title above settings section
|
164 |
-
'bnfw_generator_callback', // Name of function that renders a description of the settings section
|
165 |
-
'bnfw-generator' // Page to show on
|
166 |
-
);
|
167 |
-
|
168 |
-
// Add - Notification Name Text
|
169 |
-
add_settings_field (
|
170 |
-
'bnfw_notification_name', // Field ID
|
171 |
-
__( 'Notification Name', 'bnfw' ), // Label to the left
|
172 |
-
'bnfw_generator_notification_name', // Name of function that renders options on the page
|
173 |
-
'bnfw-generator', // Page to show on
|
174 |
-
'bnfw_generator_section' // Associate with which settings section?
|
175 |
-
);
|
176 |
-
|
177 |
-
// Add - Notification User Roles
|
178 |
-
add_settings_field (
|
179 |
-
'bnfw_user_roles', // Field ID
|
180 |
-
__( 'User Roles', 'bnfw' ), // Label to the left
|
181 |
-
'bnfw_generator_user_roles', // Name of function that renders options on the page
|
182 |
-
'bnfw-generator', // Page to show on
|
183 |
-
'bnfw_generator_section' // Associate with which settings section?
|
184 |
-
);
|
185 |
-
|
186 |
-
// Add - Notification Users
|
187 |
-
add_settings_field (
|
188 |
-
'bnfw_users', // Field ID
|
189 |
-
__( 'User', 'bnfw' ), // Label to the left
|
190 |
-
'bnfw_generator_users', // Name of function that renders options on the page
|
191 |
-
'bnfw-generator', // Page to show on
|
192 |
-
'bnfw_generator_section' // Associate with which settings section?
|
193 |
-
);
|
194 |
-
|
195 |
-
|
196 |
-
// Register - All Generator Fields
|
197 |
-
register_setting ( 'bnfw-generator', 'bnfw_notification_name' );
|
198 |
-
register_setting ( 'bnfw-generator', 'bnfw_user_roles' );
|
199 |
-
register_setting ( 'bnfw-generator', 'bnfw_users' );
|
200 |
-
}
|
201 |
-
add_action('admin_init', 'bnfw_generator_options');
|
202 |
-
|
203 |
-
/* ------------------------------------------------------------------------ *
|
204 |
-
* Notification Generator - Form Section Callbacks
|
205 |
-
* ------------------------------------------------------------------------ */
|
206 |
-
|
207 |
-
function bnfw_generator_callback() {}
|
208 |
-
|
209 |
-
/* ------------------------------------------------------------------------ *
|
210 |
-
* Notification Generator - Field Callbacks
|
211 |
-
* ------------------------------------------------------------------------ */
|
212 |
-
|
213 |
-
function bnfw_generator_notification_name($args) {
|
214 |
-
|
215 |
-
$settings = get_option( 'bnfw_notification_name' );
|
216 |
-
// Show this field if page isn't bnfw-notifications.php
|
217 |
-
if (strcmp(basename($_SERVER['PHP_SELF']), "bnfw-notifications.php") != 0) {
|
218 |
-
echo '<input type="text" name="bnfw_notification_name" value="'. $settings .'">';
|
219 |
-
}
|
220 |
-
}
|
221 |
-
|
222 |
-
function bnfw_generator_user_roles($args) {
|
223 |
-
|
224 |
-
$settings = get_option( 'bnfw_user_roles' );
|
225 |
-
|
226 |
-
echo '<select multiple name="bnfw_user_roles" id="' . $settings . '" class="select2 populate">';
|
227 |
-
global $wp_roles;
|
228 |
-
$roles = $wp_roles->get_names();
|
229 |
-
|
230 |
-
echo '<option value="'.$settings.'" selected>' . $settings . '</option>';
|
231 |
-
|
232 |
-
foreach($roles as $role) {
|
233 |
-
echo '<option value="'.$role.'">' . $role . '</option>';
|
234 |
-
}
|
235 |
-
echo '</select>';
|
236 |
-
}
|
237 |
-
|
238 |
-
|
239 |
-
function bnfw_generator_users($args) {
|
240 |
-
|
241 |
-
$user_roles = get_option( 'bnfw_user_roles' );
|
242 |
-
$single_users = get_option( 'bnfw_users' );
|
243 |
-
|
244 |
-
// Enable Users Checkbox
|
245 |
-
echo '<div id="bnfw-users-enable" class="checkbox bnfw-field">
|
246 |
-
<label for="bnfw-users-enable-checkbox">',
|
247 |
-
__( 'Do you want to specify individual users from the user roles selected above?', 'bnfw' ),
|
248 |
-
'</label>
|
249 |
-
<input type="checkbox" id="bnfw-users-enable-checkbox">
|
250 |
-
</div>';
|
251 |
-
|
252 |
-
echo '<select multiple name="bnfw_users" id="' . $single_users . '" class="select2 populate">';
|
253 |
-
global $wp_roles;
|
254 |
-
$roles = $wp_roles->get_names();
|
255 |
-
|
256 |
-
echo '<option value="'.$single_users.'" selected>' . $single_users . '</option>';
|
257 |
-
|
258 |
-
foreach($roles as $role) {
|
259 |
-
echo '<option value="'.$role.'">' . $role . '</option>';
|
260 |
-
}
|
261 |
-
echo '</select>';
|
262 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
* Register the Admin pages and load the scripts action
|
4 |
+
**/
|
5 |
|
6 |
+
/**
|
7 |
+
* Sub-menu pages
|
8 |
+
*/
|
9 |
function bnfw_admin_menu() {
|
10 |
|
11 |
+
// New Notifications Sub-menu
|
12 |
+
add_submenu_page(
|
13 |
+
'edit.php?post_type=bnfw_notification',
|
14 |
+
__( 'Notification Settings', 'bnfw' ),
|
15 |
+
__( 'Settings', 'bnfw' ),
|
16 |
+
'manage_options',
|
17 |
+
'bnfw-settings',
|
18 |
+
'bnfw_settings_page'
|
19 |
+
);
|
20 |
}
|
21 |
// Add the Admin pages to the WordPress menu
|
22 |
add_action( 'admin_menu', 'bnfw_admin_menu' );
|
25 |
* Menu Pages
|
26 |
* ------------------------------------------------------------------------ */
|
27 |
|
28 |
+
/**
|
29 |
+
* Settings Page
|
30 |
+
*/
|
31 |
function bnfw_settings_page() {
|
32 |
+
ob_start(); ?>
|
33 |
|
34 |
<div class="wrap">
|
35 |
<?php screen_icon(); ?>
|
36 |
+
<h2><?php _e( 'BNFW Settings', 'bnfw' ); ?></h2>
|
37 |
|
38 |
<form method="post" action="options.php" class="bnfw-form">
|
39 |
+
<?php
|
40 |
+
settings_errors();
|
41 |
+
settings_fields( 'bnfw-settings' );
|
42 |
+
do_settings_sections( 'bnfw-settings' );
|
43 |
|
44 |
+
submit_button( 'Save Settings' );
|
45 |
+
?>
|
46 |
</form>
|
47 |
</div>
|
48 |
|
52 |
/* ------------------------------------------------------------------------ *
|
53 |
* Settings Page - Setting Registration
|
54 |
* ------------------------------------------------------------------------ */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
|
56 |
+
/**
|
57 |
+
*
|
58 |
+
*/
|
59 |
+
function bnfw_general_options() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
+
// Set-up - General Options Section
|
62 |
+
add_settings_section (
|
63 |
+
'bnfw_general_options_section', // Section ID
|
64 |
+
'', // Title above settings section
|
65 |
+
'bnfw_general_options_callback', // Name of function that renders a description of the settings section
|
66 |
+
'bnfw-settings' // Page to show on
|
67 |
+
);
|
68 |
+
|
69 |
+
// Suppress notifications for SPAM comments
|
70 |
+
add_settings_field (
|
71 |
+
'bnfw_suppress_spam', // Field ID
|
72 |
+
__( 'Suppress SPAM comment notification', 'bnfw' ), // Label to the left
|
73 |
+
'bnfw_suppress_spam_checkbox', // Name of function that renders options on the page
|
74 |
+
'bnfw-settings', // Page to show on
|
75 |
+
'bnfw_general_options_section', // Associate with which settings section?
|
76 |
+
array(
|
77 |
+
__( "Don't send notifications for comments marked as SPAM by Akismet", 'bnfw' )
|
78 |
+
)
|
79 |
+
);
|
80 |
+
|
81 |
+
// Register - Suppress SPAM Checkbox
|
82 |
+
register_setting (
|
83 |
+
'bnfw-settings',
|
84 |
+
'bnfw_suppress_spam'
|
85 |
+
);
|
86 |
}
|
87 |
+
add_action( 'admin_init', 'bnfw_general_options' );
|
88 |
|
89 |
/* ------------------------------------------------------------------------ *
|
90 |
* Settings Page - Settings Section Callbacks
|
91 |
* ------------------------------------------------------------------------ */
|
92 |
|
93 |
+
/**
|
94 |
+
*
|
95 |
+
*/
|
96 |
function bnfw_general_options_callback() {}
|
97 |
|
98 |
/* ------------------------------------------------------------------------ *
|
99 |
* Settings Page - Settings Field Callbacks
|
100 |
* ------------------------------------------------------------------------ */
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
/**
|
103 |
* Suppress SPAM checkbox.
|
104 |
*
|
105 |
* @since 1.0
|
106 |
+
* @param unknown $args
|
107 |
*/
|
108 |
function bnfw_suppress_spam_checkbox( $args ) {
|
109 |
?>
|
111 |
<label for="bnfw_suppress_spam"><?php echo $args[0]; ?></label>
|
112 |
<?php
|
113 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/admin/class-bnfw-notification.php
CHANGED
@@ -4,144 +4,148 @@
|
|
4 |
*
|
5 |
* @since 1.0
|
6 |
*/
|
|
|
7 |
class BNFW_Notification {
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
|
|
|
|
|
|
145 |
?>
|
146 |
<table class="form-table">
|
147 |
<tbody>
|
@@ -155,99 +159,94 @@ class BNFW_Notification {
|
|
155 |
<option value="new-comment" <?php selected( 'new-comment', $setting['notification'] );?>><?php _e( 'New Comment / Awaiting Moderation', 'bnfw' ); ?></option>
|
156 |
<option value="new-trackback" <?php selected( 'new-trackback', $setting['notification'] );?>><?php _e( 'New Trackback', 'bnfw' );?></option>
|
157 |
<option value="new-pingback" <?php selected( 'new-pingback', $setting['notification'] );?>><?php _e( 'New Pingback', 'bnfw' );?></option>
|
158 |
-
<option value="
|
159 |
-
<option value="
|
|
|
|
|
|
|
|
|
|
|
160 |
</optgroup>
|
161 |
<optgroup label="Posts">
|
162 |
<option value="new-post" <?php selected( 'new-post', $setting['notification'] );?>><?php _e( 'New Post Published', 'bnfw' );?></option>
|
163 |
<option value="update-post" <?php selected( 'update-post', $setting['notification'] );?>><?php _e( 'Post Updated', 'bnfw' );?></option>
|
164 |
-
|
165 |
-
|
|
|
166 |
</optgroup>
|
167 |
<?php
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
|
|
175 |
?>
|
176 |
<optgroup label="<?php _e( 'Custom Post Type - ', 'bnfw' ); echo $type; ?>">
|
177 |
-
<option value="new-<?php echo $type; ?>" <?php selected( 'new-' . $type, $setting['notification'] );?>><?php echo __( 'New ', 'bnfw' ), $
|
178 |
-
<option value="update-<?php echo $type; ?>" <?php selected( 'update-' . $type, $setting['notification'] );?>><?php echo __( 'Update ', 'bnfw' )
|
179 |
-
|
180 |
</optgroup>
|
181 |
<?php
|
182 |
-
|
183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
?>
|
185 |
<optgroup label="<?php _e( 'Custom Taxonomy', 'bnfw' );?>">
|
186 |
-
|
187 |
</optgroup>
|
188 |
-
</select>
|
189 |
-
</td>
|
190 |
-
</tr>
|
191 |
<?php
|
192 |
-
|
|
|
193 |
?>
|
194 |
-
|
195 |
-
<th scope="row">
|
196 |
-
<?php _e( 'From Name and Email', 'bnfw' ); ?>
|
197 |
-
</th>
|
198 |
-
<td>
|
199 |
-
<input type="text" name="from-name" value="<?php echo $setting['from-name']; ?>" placeholder="Site Name" style="width:37%">
|
200 |
-
<input type="email" name="from-email" value="<?php echo $setting['from-email']; ?>" placeholder="Admin Email" style="width:37%">
|
201 |
</td>
|
202 |
</tr>
|
203 |
|
204 |
-
<tr valign="top">
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
<input type="email" name="cc-email" value="<?php echo $setting['cc-email']; ?>" placeholder="Additional email addresses" style="width:50%;">
|
212 |
-
</td>
|
213 |
</tr>
|
214 |
|
215 |
-
<tr valign="top">
|
216 |
-
<th scope="row">
|
217 |
-
<?php _e( 'BCC', 'bnfw' ); ?>
|
218 |
-
</th>
|
219 |
-
|
220 |
-
<td>
|
221 |
-
<?php $this->render_roles_dropdown( 'bcc-roles', $setting['bcc-roles'] ); ?>
|
222 |
-
<input type="email" name="bcc-email" value="<?php echo $setting['bcc-email']; ?>" placeholder="Additional email addresses" style="width:50%;">
|
223 |
-
</td>
|
224 |
-
</tr>
|
225 |
-
<?php
|
226 |
-
}
|
227 |
-
?>
|
228 |
-
<tr valign="top">
|
229 |
<th scope="row">
|
230 |
<?php _e( 'User Roles', 'bnfw' ); ?>
|
231 |
</th>
|
232 |
<?php
|
233 |
-
|
234 |
-
|
235 |
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
?>
|
241 |
<td>
|
242 |
<div id="bnfw_user_role_container" style="<?php echo $roles_style; ?>">
|
243 |
<select multiple name="user-roles[]" class="select2" data-placeholder="Select User Role" style="width:75%">
|
244 |
<?php
|
245 |
-
|
246 |
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
?>
|
252 |
</select><br>
|
253 |
<a id="bnfw_user_role_toggle" href="#"><?php _e( 'Define individual users instead', 'bnfw' );?></a>
|
@@ -256,14 +255,14 @@ class BNFW_Notification {
|
|
256 |
<div id="bnfw_user_container" style="<?php echo $user_style; ?>">
|
257 |
<select multiple name="users[]" class="select2" data-placeholder="Select Users" style="width:75%">
|
258 |
<?php
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
?>
|
268 |
</select><br>
|
269 |
<a id="bnfw_user_toggle" href="#"><?php _e( 'Define user roles instead', 'bnfw' );?></a>
|
@@ -291,167 +290,182 @@ class BNFW_Notification {
|
|
291 |
</tbody>
|
292 |
</table>
|
293 |
<?php
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
|
|
|
|
|
|
|
|
303 |
?>
|
304 |
-
<select <?php echo $multiple; ?> name="<?php echo $field; if( !empty( $multiple ) ) echo '[]';?>" id="<?php echo $field;?>" class="select2" data-placeholder="Select User Role" style="width:<?php echo $width; ?>%">
|
305 |
<?php
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
?>
|
317 |
</select>
|
318 |
<?php
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
?>
|
456 |
<div class="submitbox" id="submitpost">
|
457 |
|
@@ -461,25 +475,32 @@ class BNFW_Notification {
|
|
461 |
</div>
|
462 |
|
463 |
<?php // Always publish. ?>
|
464 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
|
466 |
<div id="major-publishing-actions">
|
467 |
|
468 |
<div id="delete-action">
|
469 |
<?php
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
<a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a>
|
477 |
</div>
|
478 |
|
479 |
<div id="publishing-action">
|
480 |
<span class="spinner"></span>
|
481 |
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Save' ) ?>">
|
482 |
-
<input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e('Save' ) ?>">
|
483 |
</div>
|
484 |
<div class="clear"></div>
|
485 |
|
@@ -490,138 +511,182 @@ class BNFW_Notification {
|
|
490 |
</div>
|
491 |
<!-- #submitpost -->
|
492 |
<?php
|
493 |
-
|
494 |
-
|
495 |
-
/**
|
496 |
-
* Get notifications based on type.
|
497 |
-
*
|
498 |
-
* @since 1.0
|
499 |
-
*/
|
500 |
-
public function get_notifications( $type ) {
|
501 |
-
$args = array(
|
502 |
-
'post_type' => self::POST_TYPE,
|
503 |
-
'meta_query' => array(
|
504 |
-
array(
|
505 |
-
'key' => self::META_KEY_PREFIX . 'notification',
|
506 |
-
'value' => $type,
|
507 |
-
),
|
508 |
-
),
|
509 |
-
);
|
510 |
-
|
511 |
-
$wp_query = new WP_Query();
|
512 |
-
$posts = $wp_query->query( $args );
|
513 |
-
return $posts;
|
514 |
-
}
|
515 |
-
|
516 |
-
/**
|
517 |
-
* Custom columns for this post type.
|
518 |
-
*
|
519 |
-
* @param array $columns
|
520 |
-
* @return array
|
521 |
-
*
|
522 |
-
* @since 1.0
|
523 |
-
* @filter manage_{post_type}_posts_columns
|
524 |
-
*/
|
525 |
-
public function columns_header( $columns ) {
|
526 |
-
$columns['type'] = __( 'Notification Type', 'bnfw' );
|
527 |
-
$columns['subject'] = __( 'Subject', 'bnfw' );
|
528 |
-
$columns['user-roles'] = __( 'User Roles/Users', 'bnfw' );
|
529 |
-
|
530 |
-
return $columns;
|
531 |
-
}
|
532 |
-
|
533 |
-
/**
|
534 |
-
* Custom column appears in each row.
|
535 |
-
*
|
536 |
-
* @param string $column Column name
|
537 |
-
* @param int $post_id Post ID
|
538 |
-
*
|
539 |
-
* @since 1.0
|
540 |
-
* @action manage_{post_type}_posts_custom_column
|
541 |
-
*/
|
542 |
-
public function custom_column_row( $column, $post_id ) {
|
543 |
-
$setting = $this->read_settings( $post_id );
|
544 |
-
switch ( $column ) {
|
545 |
-
case 'type':
|
546 |
-
echo $this->get_notifications_name( $setting['notification'] );
|
547 |
-
break;
|
548 |
-
case 'subject':
|
549 |
-
echo ! empty( $setting['subject'] ) ? $setting['subject'] : '';
|
550 |
-
break;
|
551 |
-
case 'user-roles':
|
552 |
-
if ( ! empty( $setting['users'] ) ) {
|
553 |
-
$users = array();
|
554 |
-
$user_query = new WP_User_Query( array( 'include' => $setting['users'] ) );
|
555 |
-
foreach ( $user_query->results as $user ) {
|
556 |
-
$users[] = $user->user_login;
|
557 |
-
}
|
558 |
-
echo implode( ', ', $users );
|
559 |
-
} else {
|
560 |
-
echo ! empty( $setting['user-roles'] ) ? implode( ', ', $setting['user-roles'] ) : '';
|
561 |
-
}
|
562 |
-
break;
|
563 |
-
}
|
564 |
-
}
|
565 |
-
|
566 |
-
/**
|
567 |
-
* Get name of the notification based on slug.
|
568 |
-
*
|
569 |
-
* @param mixed $slug
|
570 |
-
*/
|
571 |
-
private function get_notifications_name( $slug ) {
|
572 |
-
switch ($slug) {
|
573 |
-
case 'new-comment':
|
574 |
-
return __( 'New Comment', 'bnfw' );
|
575 |
-
break;
|
576 |
-
case 'new-trackback':
|
577 |
-
return __( 'New Trackback', 'bnfw' );
|
578 |
-
break;
|
579 |
-
case 'new-pingback':
|
580 |
-
return __( 'New Pingback', 'bnfw' );
|
581 |
-
break;
|
582 |
-
case 'user-password':
|
583 |
-
return __( 'Password Reset', 'bnfw' );
|
584 |
-
break;
|
585 |
-
case 'new-user':
|
586 |
-
return __( 'User Registration', 'bnfw' );
|
587 |
-
break;
|
588 |
-
case 'new-post':
|
589 |
-
return __( 'New Post Published', 'bnfw' );
|
590 |
-
break;
|
591 |
-
case 'update-post':
|
592 |
-
return __( 'Post Updated', 'bnfw' );
|
593 |
-
break;
|
594 |
-
case 'pending-post':
|
595 |
-
return __( 'Post Pending Review', 'bnfw' );
|
596 |
-
break;
|
597 |
-
case 'new-category':
|
598 |
-
return __( 'New Category', 'bnfw' );
|
599 |
-
break;
|
600 |
-
default:
|
601 |
-
$splited = explode( '-', $slug );
|
602 |
-
switch ( $splited[1] ) {
|
603 |
-
case 'new':
|
604 |
-
return __( 'New ', 'bnfw' ) . $splited[1];
|
605 |
-
break;
|
606 |
-
case 'update':
|
607 |
-
return __( 'Updated ', 'bnfw' ) . $splited[1];
|
608 |
-
break;
|
609 |
-
case 'pending':
|
610 |
-
return $splited[1] . __( ' Pending Review', 'bnfw' );
|
611 |
-
break;
|
612 |
-
}
|
613 |
-
break;
|
614 |
-
}
|
615 |
-
}
|
616 |
|
617 |
/**
|
618 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
619 |
*
|
620 |
-
* @param
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
621 |
* @return array
|
622 |
-
|
623 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
624 |
* @filter post_row_actions
|
|
|
|
|
625 |
*/
|
626 |
public function custom_row_actions( $actions ) {
|
627 |
$post = get_post();
|
4 |
*
|
5 |
* @since 1.0
|
6 |
*/
|
7 |
+
|
8 |
class BNFW_Notification {
|
9 |
|
10 |
+
const POST_TYPE = 'bnfw_notification';
|
11 |
+
const META_KEY_PREFIX = 'bnfw_';
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
public function __construct() {
|
17 |
+
|
18 |
+
add_action( 'init', array( $this, 'register_post_type' ) );
|
19 |
+
add_action( 'do_meta_boxes', array( $this, 'remove_meta_boxes' ) );
|
20 |
+
add_action( 'add_meta_boxes_' . self::POST_TYPE, array( $this, 'add_meta_boxes' ) );
|
21 |
+
add_action( 'save_post', array( $this, 'save_meta_data' ) );
|
22 |
+
add_filter( 'post_updated_messages', array( $this, 'post_updated_messages' ) );
|
23 |
+
|
24 |
+
// Custom row actions.
|
25 |
+
add_filter( 'post_row_actions', array( $this, 'custom_row_actions' ), 10, 2 );
|
26 |
+
|
27 |
+
// Custom columns
|
28 |
+
add_filter( sprintf( 'manage_%s_posts_columns', self::POST_TYPE ), array( $this, 'columns_header' ) );
|
29 |
+
add_action( sprintf( 'manage_%s_posts_custom_column', self::POST_TYPE ), array( $this, 'custom_column_row' ), 10, 2 );
|
30 |
+
|
31 |
+
// Enqueue scripts/styles and disables autosave for this post type.
|
32 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Register bnfw_notification custom post type.
|
37 |
+
*
|
38 |
+
* @since 1.0
|
39 |
+
*/
|
40 |
+
public function register_post_type() {
|
41 |
+
register_post_type( self::POST_TYPE, array(
|
42 |
+
'labels' => array(
|
43 |
+
'name' => __( 'Notifications', 'bnfw' ),
|
44 |
+
'singular_name' => __( 'Notification', 'bnfw' ),
|
45 |
+
'add_new' => __( 'Add New', 'bnfw' ),
|
46 |
+
'menu_name' => __( 'Notifications', 'bnfw' ),
|
47 |
+
'name_admin_bar' => __( 'Notifications', 'bnfw' ),
|
48 |
+
'add_new_item' => __( 'Add New Notification', 'bnfw' ),
|
49 |
+
'edit_item' => __( 'Edit Notification', 'bnfw' ),
|
50 |
+
'new_item' => __( 'New Notification', 'bnfw' ),
|
51 |
+
'view_item' => __( 'View Notification', 'bnfw' ),
|
52 |
+
'search_items' => __( 'Search Notifications', 'bnfw' ),
|
53 |
+
'not_found' => __( 'No Notifications found', 'bnfw' ),
|
54 |
+
'not_found_in_trash' => __( 'No Notifications found in trash', 'bnfw' ),
|
55 |
+
'all_items' => __( 'All Notifications', 'bnfw' )
|
56 |
+
),
|
57 |
+
'public' => false,
|
58 |
+
'show_in_nav_menus' => true,
|
59 |
+
'show_in_admin_bar' => true,
|
60 |
+
'has_archive' => false,
|
61 |
+
'show_ui' => true,
|
62 |
+
'show_in_menu' => true,
|
63 |
+
'menu_icon' => 'dashicons-email-alt',
|
64 |
+
'menu_position' => 100,
|
65 |
+
'rewrite' => false,
|
66 |
+
'map_meta_cap' => false,
|
67 |
+
'capabilities' => array(
|
68 |
+
|
69 |
+
// meta caps (don't assign these to roles)
|
70 |
+
'edit_post' => 'manage_options',
|
71 |
+
'read_post' => 'manage_options',
|
72 |
+
'delete_post' => 'manage_options',
|
73 |
+
|
74 |
+
// primitive/meta caps
|
75 |
+
'create_posts' => 'manage_options',
|
76 |
+
|
77 |
+
// primitive caps used outside of map_meta_cap()
|
78 |
+
'edit_posts' => 'manage_options',
|
79 |
+
'edit_others_posts' => 'manage_options',
|
80 |
+
'publish_posts' => 'manage_options',
|
81 |
+
'read_private_posts' => 'manage_options',
|
82 |
+
|
83 |
+
// primitive caps used inside of map_meta_cap()
|
84 |
+
'read' => 'manage_options',
|
85 |
+
'delete_posts' => 'manage_options',
|
86 |
+
'delete_private_posts' => 'manage_options',
|
87 |
+
'delete_published_posts' => 'manage_options',
|
88 |
+
'delete_others_posts' => 'manage_options',
|
89 |
+
'edit_private_posts' => 'manage_options',
|
90 |
+
'edit_published_posts' => 'manage_options',
|
91 |
+
),
|
92 |
+
|
93 |
+
// What features the post type supports.
|
94 |
+
'supports' => array(
|
95 |
+
'title',
|
96 |
+
),
|
97 |
+
) );
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Remove unwanted meta boxes.
|
102 |
+
*
|
103 |
+
* @since 1.0
|
104 |
+
*/
|
105 |
+
public function remove_meta_boxes() {
|
106 |
+
remove_meta_box( 'submitdiv', self::POST_TYPE, 'side' );
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* Add meta box to the post editor screen.
|
111 |
+
*
|
112 |
+
* @since 1.0
|
113 |
+
*/
|
114 |
+
public function add_meta_boxes() {
|
115 |
+
add_meta_box(
|
116 |
+
'bnfw-post-notification', // Unique ID
|
117 |
+
esc_html__( 'Notification Settings', 'bnfw' ), // Title
|
118 |
+
array( $this, 'render_settings_meta_box' ), // Callback function
|
119 |
+
self::POST_TYPE, // Admin page (or post type)
|
120 |
+
'normal' // Context
|
121 |
+
);
|
122 |
+
|
123 |
+
add_meta_box(
|
124 |
+
'bnfw_submitdiv',
|
125 |
+
__( 'Save Notification', 'bnfw' ),
|
126 |
+
array( $this, 'render_submitdiv' ),
|
127 |
+
self::POST_TYPE,
|
128 |
+
'side',
|
129 |
+
'core'
|
130 |
+
);
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Render the settings meta box.
|
135 |
+
*
|
136 |
+
* @since 1.0
|
137 |
+
* @param unknown $post
|
138 |
+
*/
|
139 |
+
public function render_settings_meta_box( $post ) {
|
140 |
+
global $wp_roles;
|
141 |
+
wp_nonce_field(
|
142 |
+
// Action
|
143 |
+
self::POST_TYPE,
|
144 |
+
// Name.
|
145 |
+
self::POST_TYPE . '_nonce'
|
146 |
+
);
|
147 |
+
|
148 |
+
$setting = $this->read_settings( $post->ID );
|
149 |
?>
|
150 |
<table class="form-table">
|
151 |
<tbody>
|
159 |
<option value="new-comment" <?php selected( 'new-comment', $setting['notification'] );?>><?php _e( 'New Comment / Awaiting Moderation', 'bnfw' ); ?></option>
|
160 |
<option value="new-trackback" <?php selected( 'new-trackback', $setting['notification'] );?>><?php _e( 'New Trackback', 'bnfw' );?></option>
|
161 |
<option value="new-pingback" <?php selected( 'new-pingback', $setting['notification'] );?>><?php _e( 'New Pingback', 'bnfw' );?></option>
|
162 |
+
<option value="admin-password" <?php selected( 'admin-password', $setting['notification'] );?>><?php _e( 'Lost Password - For Admin', 'bnfw' );?></option>
|
163 |
+
<option value="admin-user" <?php selected( 'admin-user', $setting['notification'] );?>><?php _e( 'New User Registration - For Admin', 'bnfw' );?></option>
|
164 |
+
</optgroup>
|
165 |
+
<optgroup label="Transactional">
|
166 |
+
<option value="user-password" <?php selected( 'user-password', $setting['notification'] );?>><?php _e( 'Lost Password - For User', 'bnfw' );?></option>
|
167 |
+
<option value="new-user" <?php selected( 'new-user', $setting['notification'] );?>><?php _e( 'New User Registration - For User', 'bnfw' );?></option>
|
168 |
+
<option value="welcome-email" <?php selected( 'welcome-email', $setting['notification'] );?>><?php _e( 'New User - Welcome Email', 'bnfw' );?></option>
|
169 |
</optgroup>
|
170 |
<optgroup label="Posts">
|
171 |
<option value="new-post" <?php selected( 'new-post', $setting['notification'] );?>><?php _e( 'New Post Published', 'bnfw' );?></option>
|
172 |
<option value="update-post" <?php selected( 'update-post', $setting['notification'] );?>><?php _e( 'Post Updated', 'bnfw' );?></option>
|
173 |
+
<option value="pending-post" <?php selected( 'pending-post', $setting['notification'] );?>><?php _e( 'Post Pending Review', 'bnfw' );?></option>
|
174 |
+
<option value="new-category" <?php selected( 'new-category', $setting['notification'] );?>><?php _e( 'New Category', 'bnfw' ); ?></option>
|
175 |
+
<option value="new-post_tag" <?php selected( 'new-post_tag', $setting['notification'] );?>><?php _e( 'New Tag', 'bnfw' ); ?></option>
|
176 |
</optgroup>
|
177 |
<?php
|
178 |
+
$types = get_post_types( array(
|
179 |
+
'_builtin' => false,
|
180 |
+
), 'names'
|
181 |
+
);
|
182 |
+
|
183 |
+
foreach ( $types as $type ) {
|
184 |
+
if ( $type != self::POST_TYPE ) {
|
185 |
+
$post_obj = get_post_type_object( $type );
|
186 |
+
$label = $post_obj->labels->singular_name;
|
187 |
?>
|
188 |
<optgroup label="<?php _e( 'Custom Post Type - ', 'bnfw' ); echo $type; ?>">
|
189 |
+
<option value="new-<?php echo $type; ?>" <?php selected( 'new-' . $type, $setting['notification'] );?>><?php echo __( 'New ', 'bnfw' ), "'$label'"; ?></option>
|
190 |
+
<option value="update-<?php echo $type; ?>" <?php selected( 'update-' . $type, $setting['notification'] );?>><?php echo "'$label' " . __( 'Update ', 'bnfw' ); ?></option>
|
191 |
+
<option value="pending-<?php echo $type; ?>" <?php selected( 'pending-' . $type, $setting['notification'] );?>><?php echo "'$label' ", __( 'Pending Review', 'bnfw' ); ?></option>
|
192 |
</optgroup>
|
193 |
<?php
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
$taxs = get_taxonomies( array(
|
198 |
+
'public' => true,
|
199 |
+
'_builtin' => false,
|
200 |
+
), 'objects'
|
201 |
+
);
|
202 |
+
|
203 |
+
if ( count( $taxs > 0 ) ) {
|
204 |
+
foreach ( $taxs as $tax ) {
|
205 |
+
$tax_name = 'newterm-' . $tax->name;
|
206 |
?>
|
207 |
<optgroup label="<?php _e( 'Custom Taxonomy', 'bnfw' );?>">
|
208 |
+
<option value="<?php echo $tax_name; ?>" <?php selected( $tax_name, $setting['notification'] );?>><?php printf( '%s %s', __( 'New', 'bnfw' ), $tax->labels->name ); ?></option>
|
209 |
</optgroup>
|
|
|
|
|
|
|
210 |
<?php
|
211 |
+
}
|
212 |
+
}
|
213 |
?>
|
214 |
+
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
</td>
|
216 |
</tr>
|
217 |
|
218 |
+
<tr valign="top" id="user-password-msg">
|
219 |
+
<td> </td>
|
220 |
+
<td>
|
221 |
+
<div style="background:#FFFFE1;padding:15px;">
|
222 |
+
<p style="margin-top: 0;"><?php esc_html_e( "This notification doesn't support additional email fields or shortcodes in the subject line", 'bnfw' ); ?></p>
|
223 |
+
</div>
|
224 |
+
</td>
|
|
|
|
|
225 |
</tr>
|
226 |
|
227 |
+
<tr valign="top" id="user-role">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
<th scope="row">
|
229 |
<?php _e( 'User Roles', 'bnfw' ); ?>
|
230 |
</th>
|
231 |
<?php
|
232 |
+
$roles_style = '';
|
233 |
+
$user_style = 'display:none';
|
234 |
|
235 |
+
if ( count( $setting['users'] ) > 0 ) {
|
236 |
+
$roles_style = 'display:none';
|
237 |
+
$user_style = '';
|
238 |
+
}
|
239 |
?>
|
240 |
<td>
|
241 |
<div id="bnfw_user_role_container" style="<?php echo $roles_style; ?>">
|
242 |
<select multiple name="user-roles[]" class="select2" data-placeholder="Select User Role" style="width:75%">
|
243 |
<?php
|
244 |
+
$roles = $wp_roles->get_names();
|
245 |
|
246 |
+
foreach ( $roles as $role ) {
|
247 |
+
$selected = selected( true, in_array( $role, $setting['user-roles'] ), false );
|
248 |
+
echo '<option value="', $role, '" ', $selected, '>', $role, '</option>';
|
249 |
+
}
|
250 |
?>
|
251 |
</select><br>
|
252 |
<a id="bnfw_user_role_toggle" href="#"><?php _e( 'Define individual users instead', 'bnfw' );?></a>
|
255 |
<div id="bnfw_user_container" style="<?php echo $user_style; ?>">
|
256 |
<select multiple name="users[]" class="select2" data-placeholder="Select Users" style="width:75%">
|
257 |
<?php
|
258 |
+
$users = get_users( array(
|
259 |
+
'order_by' => 'email',
|
260 |
+
) );
|
261 |
+
|
262 |
+
foreach ( $users as $user ) {
|
263 |
+
$selected = selected( true, in_array( $user->ID, $setting['users'] ), false );
|
264 |
+
echo '<option value="', $user->ID, '" ', $selected, '>', $user->user_login, '</option>';
|
265 |
+
}
|
266 |
?>
|
267 |
</select><br>
|
268 |
<a id="bnfw_user_toggle" href="#"><?php _e( 'Define user roles instead', 'bnfw' );?></a>
|
290 |
</tbody>
|
291 |
</table>
|
292 |
<?php
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Render user roles dropdown.
|
297 |
+
*
|
298 |
+
* @since 1.0
|
299 |
+
* @param unknown $field
|
300 |
+
* @param unknown $value
|
301 |
+
* @param unknown $multiple (optional)
|
302 |
+
* @param unknown $width (optional)
|
303 |
+
*/
|
304 |
+
private function render_roles_dropdown( $field, $value, $multiple = '', $width = 25 ) {
|
305 |
+
global $wp_roles;
|
306 |
?>
|
307 |
+
<select <?php echo $multiple; ?> name="<?php echo $field; if ( ! empty( $multiple ) ) echo '[]';?>" id="<?php echo $field;?>" class="select2" data-placeholder="Select User Role" style="width:<?php echo $width; ?>%">
|
308 |
<?php
|
309 |
+
$roles = $wp_roles->get_names();
|
310 |
+
|
311 |
+
foreach ( $roles as $role ) {
|
312 |
+
if ( empty( $multiple ) ) {
|
313 |
+
$selected = selected( $value, $role, false );
|
314 |
+
} else {
|
315 |
+
$selected = selected( true, in_array( $role, $value ), false );
|
316 |
+
}
|
317 |
+
echo '<option value="', $role, '" ', $selected, '>', $role, '</option>';
|
318 |
+
}
|
319 |
?>
|
320 |
</select>
|
321 |
<?php
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* Enqueue scripts.
|
326 |
+
*
|
327 |
+
* @since 1.0
|
328 |
+
*/
|
329 |
+
public function enqueue_scripts() {
|
330 |
+
if ( self::POST_TYPE === get_post_type() ) {
|
331 |
+
wp_dequeue_script( 'autosave' );
|
332 |
+
|
333 |
+
wp_enqueue_style( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.css', array(), '3.5.2' );
|
334 |
+
wp_enqueue_script( 'select2', '//cdnjs.cloudflare.com/ajax/libs/select2/3.5.2/select2.min.js', array( 'jquery' ), '3.5.2', true );
|
335 |
+
wp_enqueue_script( 'bnfw', plugins_url( '../assets/js/bnfw.js', dirname( __FILE__ ) ), array( 'jquery' ), '0.1', true );
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Save the meta box's post metadata.
|
341 |
+
*
|
342 |
+
* @since 1.0
|
343 |
+
* @param int $post_id The ID of the post being saved.
|
344 |
+
*/
|
345 |
+
public function save_meta_data( $post_id ) {
|
346 |
+
|
347 |
+
if ( self::POST_TYPE !== get_post_type( $post_id ) ) {
|
348 |
+
return;
|
349 |
+
}
|
350 |
+
|
351 |
+
// Check nonce.
|
352 |
+
if ( empty( $_POST[ self::POST_TYPE . '_nonce' ] ) ) {
|
353 |
+
return;
|
354 |
+
}
|
355 |
+
|
356 |
+
// Verify nonce.
|
357 |
+
if ( ! wp_verify_nonce( $_POST[ self::POST_TYPE . '_nonce' ], self::POST_TYPE ) ) {
|
358 |
+
return;
|
359 |
+
}
|
360 |
+
|
361 |
+
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
362 |
+
return;
|
363 |
+
}
|
364 |
+
|
365 |
+
if ( ! current_user_can( 'manage_options' ) ) {
|
366 |
+
return;
|
367 |
+
}
|
368 |
+
|
369 |
+
$setting = array(
|
370 |
+
'notification' => $_POST['notification'],
|
371 |
+
'subject' => sanitize_text_field( $_POST['subject'] ),
|
372 |
+
'message' => $_POST['message'],
|
373 |
+
'disabled' => sanitize_text_field( $_POST['disabled'] ),
|
374 |
+
//'show-fields' => sanitize_text_field( $_POST['show-fields'] ),
|
375 |
+
);
|
376 |
+
|
377 |
+
if ( isset( $_POST['user-roles'] ) ) {
|
378 |
+
$setting['user-roles'] = $_POST['user-roles'];
|
379 |
+
$setting['users'] = array();
|
380 |
+
} else {
|
381 |
+
$setting['user-roles'] = array();
|
382 |
+
$setting['users'] = $_POST['users'];
|
383 |
+
}
|
384 |
+
|
385 |
+
//if ( 'true' == $setting['show-fields'] ) {
|
386 |
+
//$setting['from-name'] = sanitize_text_field( $_POST['from-name'] );
|
387 |
+
//$setting['from-email'] = sanitize_email( $_POST['from-email'] );
|
388 |
+
//$setting['cc-email'] = sanitize_email( $_POST['cc-email'] );
|
389 |
+
//$setting['cc-roles'] = $_POST['cc-roles'];
|
390 |
+
//$setting['bcc-email'] = sanitize_email( $_POST['bcc-email'] );
|
391 |
+
//$setting['bcc-roles'] = $_POST['bcc-roles'];
|
392 |
+
//}
|
393 |
+
|
394 |
+
$this->save_settings( $post_id, $setting );
|
395 |
+
}
|
396 |
+
|
397 |
+
/**
|
398 |
+
* Save settings in post meta.
|
399 |
+
*
|
400 |
+
* @since 1.0
|
401 |
+
* @access private
|
402 |
+
* @param unknown $post_id
|
403 |
+
* @param unknown $setting
|
404 |
+
*/
|
405 |
+
private function save_settings( $post_id, $setting ) {
|
406 |
+
foreach ( $setting as $key => $value ) {
|
407 |
+
update_post_meta( $post_id, self::META_KEY_PREFIX . $key, $value );
|
408 |
+
}
|
409 |
+
}
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Read settings from post meta.
|
413 |
+
*
|
414 |
+
* @since 1.0
|
415 |
+
* @param unknown $post_id
|
416 |
+
* @return unknown
|
417 |
+
*/
|
418 |
+
public function read_settings( $post_id ) {
|
419 |
+
$setting = array();
|
420 |
+
$default = array(
|
421 |
+
'notification' => '',
|
422 |
+
'from-name' => '',
|
423 |
+
'from-email' => '',
|
424 |
+
'cc-email' => '',
|
425 |
+
'cc-roles' => '',
|
426 |
+
'bcc-email' => '',
|
427 |
+
'bcc-roles' => '',
|
428 |
+
'user-roles' => array(),
|
429 |
+
'users' => array(),
|
430 |
+
'subject' => '',
|
431 |
+
'message' => '',
|
432 |
+
//'show-fields' => 'false',
|
433 |
+
'disabled' => 'false',
|
434 |
+
);
|
435 |
+
|
436 |
+
foreach ( $default as $key => $default_value ) {
|
437 |
+
$value = get_post_meta( $post_id, self::META_KEY_PREFIX . $key, true );
|
438 |
+
if ( ! empty( $value ) ) {
|
439 |
+
$setting[ $key ] = $value;
|
440 |
+
} else {
|
441 |
+
$setting[ $key ] = $default_value;
|
442 |
+
}
|
443 |
+
}
|
444 |
+
|
445 |
+
return $setting;
|
446 |
+
}
|
447 |
+
|
448 |
+
/**
|
449 |
+
* Change the post updated message for notification post type.
|
450 |
+
*
|
451 |
+
* @since 1.0
|
452 |
+
* @param unknown $messages
|
453 |
+
* @return unknown
|
454 |
+
*/
|
455 |
+
public function post_updated_messages( $messages ) {
|
456 |
+
$messages[ self::POST_TYPE ] = array_fill( 0, 11, __( 'Notification saved.', 'bnfw' ) );
|
457 |
+
|
458 |
+
return $messages;
|
459 |
+
}
|
460 |
+
|
461 |
+
/**
|
462 |
+
* Render submit div meta box.
|
463 |
+
*
|
464 |
+
* @since 1.0
|
465 |
+
* @param unknown $post
|
466 |
+
*/
|
467 |
+
public function render_submitdiv( $post ) {
|
468 |
+
global $post;
|
469 |
?>
|
470 |
<div class="submitbox" id="submitpost">
|
471 |
|
475 |
</div>
|
476 |
|
477 |
<?php // Always publish. ?>
|
478 |
+
<div class="disable-notification-checkbox" style="padding: 5px 0 10px 0;">
|
479 |
+
<input type="hidden" name="post_status" id="hidden_post_status" value="publish">
|
480 |
+
|
481 |
+
<?php
|
482 |
+
$setting = $this->read_settings( $post->ID );
|
483 |
+
?>
|
484 |
+
<input type="checkbox" name="disabled" value="true" <?php checked( $setting['disabled'], 'true', true ); ?>><?php _e( 'Disable Notification', 'bnfw' ); ?>
|
485 |
+
</div>
|
486 |
|
487 |
<div id="major-publishing-actions">
|
488 |
|
489 |
<div id="delete-action">
|
490 |
<?php
|
491 |
+
if ( ! EMPTY_TRASH_DAYS ) {
|
492 |
+
$delete_text = __( 'Delete Permanently', 'bnfw' );
|
493 |
+
} else {
|
494 |
+
$delete_text = __( 'Move to Trash', 'bnfw' );
|
495 |
+
}
|
496 |
+
?>
|
497 |
<a class="submitdelete deletion" href="<?php echo get_delete_post_link( $post->ID ); ?>"><?php echo $delete_text; ?></a>
|
498 |
</div>
|
499 |
|
500 |
<div id="publishing-action">
|
501 |
<span class="spinner"></span>
|
502 |
<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e( 'Save' ) ?>">
|
503 |
+
<input name="save" type="submit" class="button button-primary button-large" id="publish" accesskey="p" value="<?php esc_attr_e( 'Save' ) ?>">
|
504 |
</div>
|
505 |
<div class="clear"></div>
|
506 |
|
511 |
</div>
|
512 |
<!-- #submitpost -->
|
513 |
<?php
|
514 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
515 |
|
516 |
/**
|
517 |
+
* Get notifications based on type.
|
518 |
+
*
|
519 |
+
* @since 1.0
|
520 |
+
* @param unknown $type
|
521 |
+
* @return unknown
|
522 |
+
*/
|
523 |
+
public function get_notifications( $type ) {
|
524 |
+
$args = array(
|
525 |
+
'post_type' => self::POST_TYPE,
|
526 |
+
'meta_query' => array(
|
527 |
+
array(
|
528 |
+
'key' => self::META_KEY_PREFIX . 'notification',
|
529 |
+
'value' => $type,
|
530 |
+
),
|
531 |
+
array(
|
532 |
+
'key' => self::META_KEY_PREFIX . 'disabled',
|
533 |
+
'value' => 'true',
|
534 |
+
'compare' => '!=',
|
535 |
+
),
|
536 |
+
),
|
537 |
+
);
|
538 |
+
|
539 |
+
$wp_query = new WP_Query();
|
540 |
+
$posts = $wp_query->query( $args );
|
541 |
+
return $posts;
|
542 |
+
}
|
543 |
+
|
544 |
+
/**
|
545 |
+
* Does a particular type of notification exists or not.
|
546 |
+
*
|
547 |
+
* @since 1.1
|
548 |
*
|
549 |
+
* @param string $type Notification Type.
|
550 |
+
* @return bool True if present, False otherwise
|
551 |
+
*/
|
552 |
+
public function notification_exists( $type ) {
|
553 |
+
$notifications = $this->get_notifications( $type );
|
554 |
+
|
555 |
+
if ( count( $notifications ) > 0 ) {
|
556 |
+
return true;
|
557 |
+
} else {
|
558 |
+
return false;
|
559 |
+
}
|
560 |
+
}
|
561 |
+
|
562 |
+
/**
|
563 |
+
* Custom columns for this post type.
|
564 |
+
*
|
565 |
+
*
|
566 |
+
* @since 1.0
|
567 |
+
* @filter manage_{post_type}_posts_columns
|
568 |
+
* @param array $columns
|
569 |
* @return array
|
570 |
+
*/
|
571 |
+
public function columns_header( $columns ) {
|
572 |
+
$columns['type'] = __( 'Notification Type', 'bnfw' );
|
573 |
+
$columns['disabled'] = __( 'Enabled?', 'bnfw' );
|
574 |
+
$columns['subject'] = __( 'Subject', 'bnfw' );
|
575 |
+
$columns['user-roles'] = __( 'User Roles/Users', 'bnfw' );
|
576 |
+
|
577 |
+
return $columns;
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Custom column appears in each row.
|
582 |
+
*
|
583 |
+
*
|
584 |
+
* @since 1.0
|
585 |
+
* @action manage_{post_type}_posts_custom_column
|
586 |
+
* @param string $column Column name
|
587 |
+
* @param int $post_id Post ID
|
588 |
+
*/
|
589 |
+
public function custom_column_row( $column, $post_id ) {
|
590 |
+
$setting = $this->read_settings( $post_id );
|
591 |
+
switch ( $column ) {
|
592 |
+
case 'disabled':
|
593 |
+
if ( 'true' != $setting['disabled'] ) {
|
594 |
+
printf( '<img src="%s" style="width:25px;">', plugins_url( '../assets/images/notification-enabled.png', dirname( __FILE__ ) ) );
|
595 |
+
}
|
596 |
+
break;
|
597 |
+
case 'type':
|
598 |
+
echo $this->get_notifications_name( $setting['notification'] );
|
599 |
+
break;
|
600 |
+
case 'subject':
|
601 |
+
echo ! empty( $setting['subject'] ) ? $setting['subject'] : '';
|
602 |
+
break;
|
603 |
+
case 'user-roles':
|
604 |
+
if ( ! empty( $setting['users'] ) ) {
|
605 |
+
$users = array();
|
606 |
+
$user_query = new WP_User_Query( array( 'include' => $setting['users'] ) );
|
607 |
+
foreach ( $user_query->results as $user ) {
|
608 |
+
$users[] = $user->user_login;
|
609 |
+
}
|
610 |
+
echo implode( ', ', $users );
|
611 |
+
} else {
|
612 |
+
echo ! empty( $setting['user-roles'] ) ? implode( ', ', $setting['user-roles'] ) : '';
|
613 |
+
}
|
614 |
+
break;
|
615 |
+
}
|
616 |
+
}
|
617 |
+
|
618 |
+
/**
|
619 |
+
* Get name of the notification based on slug.
|
620 |
+
*
|
621 |
+
* @param mixed $slug
|
622 |
+
* @return unknown
|
623 |
+
*/
|
624 |
+
private function get_notifications_name( $slug ) {
|
625 |
+
switch ( $slug ) {
|
626 |
+
case 'new-comment':
|
627 |
+
return __( 'New Comment', 'bnfw' );
|
628 |
+
break;
|
629 |
+
case 'new-trackback':
|
630 |
+
return __( 'New Trackback', 'bnfw' );
|
631 |
+
break;
|
632 |
+
case 'new-pingback':
|
633 |
+
return __( 'New Pingback', 'bnfw' );
|
634 |
+
break;
|
635 |
+
case 'user-password':
|
636 |
+
return __( 'Lost Password - For User', 'bnfw' );
|
637 |
+
break;
|
638 |
+
case 'admin-password':
|
639 |
+
return __( 'Lost Password - For Admin', 'bnfw' );
|
640 |
+
break;
|
641 |
+
case 'new-user':
|
642 |
+
return __( 'User Registration - For User', 'bnfw' );
|
643 |
+
break;
|
644 |
+
case 'welcome-email':
|
645 |
+
return __( 'New User - Welcome email', 'bnfw' );
|
646 |
+
break;
|
647 |
+
case 'admin-user':
|
648 |
+
return __( 'User Registration - For Admin', 'bnfw' );
|
649 |
+
break;
|
650 |
+
case 'new-post':
|
651 |
+
return __( 'New Post Published', 'bnfw' );
|
652 |
+
break;
|
653 |
+
case 'update-post':
|
654 |
+
return __( 'Post Updated', 'bnfw' );
|
655 |
+
break;
|
656 |
+
case 'pending-post':
|
657 |
+
return __( 'Post Pending Review', 'bnfw' );
|
658 |
+
break;
|
659 |
+
case 'new-category':
|
660 |
+
return __( 'New Category', 'bnfw' );
|
661 |
+
break;
|
662 |
+
case 'new-post_tag':
|
663 |
+
return __( 'New Tag', 'bnfw' );
|
664 |
+
break;
|
665 |
+
default:
|
666 |
+
$splited = explode( '-', $slug );
|
667 |
+
switch ( $splited[1] ) {
|
668 |
+
case 'new':
|
669 |
+
return __( 'New ', 'bnfw' ) . $splited[1];
|
670 |
+
break;
|
671 |
+
case 'update':
|
672 |
+
return __( 'Updated ', 'bnfw' ) . $splited[1];
|
673 |
+
break;
|
674 |
+
case 'pending':
|
675 |
+
return $splited[1] . __( ' Pending Review', 'bnfw' );
|
676 |
+
break;
|
677 |
+
}
|
678 |
+
break;
|
679 |
+
}
|
680 |
+
}
|
681 |
+
|
682 |
+
/**
|
683 |
+
* Custom row actions for this post type.
|
684 |
+
*
|
685 |
+
*
|
686 |
+
* @since 1.0
|
687 |
* @filter post_row_actions
|
688 |
+
* @param array $actions
|
689 |
+
* @return array
|
690 |
*/
|
691 |
public function custom_row_actions( $actions ) {
|
692 |
$post = get_post();
|
includes/debug.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**------------------------------------------------------------------------ *
|
3 |
-
* Debugger functions
|
4 |
-
*
|
5 |
-
* Include this file for debugging
|
6 |
-
* ------------------------------------------------------------------------ */
|
7 |
-
|
8 |
-
// Debugger
|
9 |
-
//add_filter('the_content', 'bnfw_debug');
|
10 |
-
|
11 |
-
// function bnfw_debug($content){
|
12 |
-
// $bnfw_options = get_option('bnfw_settings');
|
13 |
-
|
14 |
-
// if ( !isset( $wp_roles ) )
|
15 |
-
// $wp_roles = new WP_Roles();
|
16 |
-
// var_dump($wp_roles->get_names());
|
17 |
-
|
18 |
-
// var_dump($bnfw_options);
|
19 |
-
// return $content;
|
20 |
-
// }
|
21 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/engine/class-bnfw-engine.php
CHANGED
@@ -4,283 +4,373 @@
|
|
4 |
*
|
5 |
* @since 1.0
|
6 |
*/
|
|
|
7 |
class BNFW_Engine {
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
$message = str_replace( '[post_tag]', $tag_list, $message );
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
}
|
286 |
?>
|
4 |
*
|
5 |
* @since 1.0
|
6 |
*/
|
7 |
+
|
8 |
class BNFW_Engine {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Send the notification email.
|
12 |
+
*
|
13 |
+
* @since 1.0
|
14 |
+
* @param unknown $setting
|
15 |
+
* @param unknown $id
|
16 |
+
*/
|
17 |
+
public function send_notification( $setting, $id ) {
|
18 |
+
$subject = $this->handle_shortcodes( $setting['subject'], $setting['notification'], $id );
|
19 |
+
$message = $this->handle_shortcodes( $setting['message'], $setting['notification'], $id );
|
20 |
+
$emails = $this->get_emails( $setting );
|
21 |
+
$headers = $this->get_headers( $emails );
|
22 |
+
$headers[] = 'Content-type: text/html';
|
23 |
+
|
24 |
+
foreach ( $emails['to'] as $email ) {
|
25 |
+
wp_mail( $email, $subject, $message, $headers );
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* Send new user registration notification email.
|
31 |
+
*
|
32 |
+
* @since 1.1
|
33 |
+
* @param array $setting Notification setting
|
34 |
+
* @param object $user User object
|
35 |
+
* @param string $password Plain text password
|
36 |
+
*/
|
37 |
+
public function send_registration_email( $setting, $user, $password = '' ) {
|
38 |
+
$user_id = $user->ID;
|
39 |
+
|
40 |
+
$subject = $this->handle_shortcodes( $setting['subject'], $setting['notification'], $user_id );
|
41 |
+
$message = $this->handle_shortcodes( $setting['message'], $setting['notification'], $user_id );
|
42 |
+
|
43 |
+
$subject = str_replace( '[password]', $password, $subject );
|
44 |
+
$message = str_replace( '[password]', $password, $message );
|
45 |
+
|
46 |
+
$subject = str_replace( '[login_url]', wp_login_url() , $subject );
|
47 |
+
$message = str_replace( '[login_url]', wp_login_url(), $message );
|
48 |
+
|
49 |
+
$headers = array( 'Content-type: text/html' );
|
50 |
+
|
51 |
+
wp_mail( $user->user_email, $subject, $message, $headers );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Handle shortcode for password reset email message.
|
56 |
+
*
|
57 |
+
* @since 1.1
|
58 |
+
*/
|
59 |
+
public function handle_password_reset_shortcodes( $setting, $key, $user_login, $user_data ) {
|
60 |
+
$message = $this->user_shortcodes( $setting['message'], $user_data->ID );
|
61 |
+
|
62 |
+
$reset_link = wp_login_url() . "?action=rp&key=$key&login=$user_login";
|
63 |
+
$message = str_replace( '[password_reset_link]', $reset_link, $message );
|
64 |
+
|
65 |
+
return $message;
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Generate message for notification.
|
70 |
+
*
|
71 |
+
* @since 1.0
|
72 |
+
* @param unknown $message
|
73 |
+
* @param unknown $notification
|
74 |
+
* @param unknown $id
|
75 |
+
* @return unknown
|
76 |
+
*/
|
77 |
+
private function handle_shortcodes( $message, $notification, $id ) {
|
78 |
+
switch ( $notification ) {
|
79 |
+
case 'new-comment':
|
80 |
+
case 'new-trackback':
|
81 |
+
case 'new-pingback':
|
82 |
+
// handle new comments, trackbacks and pingbacks
|
83 |
+
$message = $this->comment_shortcodes( $message, $id );
|
84 |
+
$comment = get_comment( $id );
|
85 |
+
$message = $this->post_shortcodes( $message, $comment->comment_post_ID );
|
86 |
+
break;
|
87 |
+
|
88 |
+
case 'admin-password':
|
89 |
+
case 'user-password':
|
90 |
+
case 'admin-user':
|
91 |
+
case 'welcome-email':
|
92 |
+
// handle users (lost password and new user registration)
|
93 |
+
$message = $this->user_shortcodes( $message, $id );
|
94 |
+
break;
|
95 |
+
|
96 |
+
case 'new-category':
|
97 |
+
// handle new category
|
98 |
+
$message = $this->taxonomy_shortcodes( $message, 'category', $id );
|
99 |
+
break;
|
100 |
+
|
101 |
+
case 'new-post_tag':
|
102 |
+
// handle new tag
|
103 |
+
$message = $this->taxonomy_shortcodes( $message, 'post_tag', $id );
|
104 |
+
break;
|
105 |
+
|
106 |
+
default:
|
107 |
+
$type = explode( '-', $notification, 2 );
|
108 |
+
if ( 'newterm' == $type[0] ) {
|
109 |
+
// handle new terms
|
110 |
+
$message = $this->taxonomy_shortcodes( $message, $type[1], $id );
|
111 |
+
|
112 |
+
} else if ( 'new' == $type[0] || 'update' == $type[0] ) {
|
113 |
+
// handle new, update and pending posts
|
114 |
+
$post_types = get_post_types( array( '_builtin' => false ), 'names' );
|
115 |
+
$post_types = array_diff( $post_types, array( BNFW_Notification::POST_TYPE ) );
|
116 |
+
array_push( $post_types, 'post' );
|
117 |
+
|
118 |
+
if ( in_array( $type[1], $post_types ) ) {
|
119 |
+
$message = $this->post_shortcodes( $message, $id );
|
120 |
+
$post = get_post( $id );
|
121 |
+
$message = $this->user_shortcodes( $message, $post->post_author );
|
122 |
+
}
|
123 |
+
}
|
124 |
+
break;
|
125 |
+
}
|
126 |
+
|
127 |
+
return $message;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Handle post shortcodes.
|
132 |
+
*
|
133 |
+
* @since 1.0
|
134 |
+
* @param unknown $message
|
135 |
+
* @param unknown $post_id
|
136 |
+
* @return unknown
|
137 |
+
*/
|
138 |
+
private function post_shortcodes( $message, $post_id ) {
|
139 |
+
$post = get_post( $post_id );
|
140 |
+
|
141 |
+
$post_content = apply_filters( 'the_content', $post->post_content );
|
142 |
+
$post_content = str_replace( ']]>', ']]>', $post_content );
|
143 |
+
|
144 |
+
$message = str_replace( '[ID]', $post->ID, $message );
|
145 |
+
$message = str_replace( '[post_author]', $post->post_author, $message );
|
146 |
+
$message = str_replace( '[post_date]', $post->post_date, $message );
|
147 |
+
$message = str_replace( '[post_date_gmt]', $post->post_date_gmt, $message );
|
148 |
+
$message = str_replace( '[post_content]', $post_content, $message );
|
149 |
+
$message = str_replace( '[post_title]', $post->post_title, $message );
|
150 |
+
$message = str_replace( '[post_excerpt]', $post->post_excerpt, $message );
|
151 |
+
$message = str_replace( '[post_status]', $post->post_status, $message );
|
152 |
+
$message = str_replace( '[comment_status]', $post->comment_status, $message );
|
153 |
+
$message = str_replace( '[ping_status]', $post->ping_status, $message );
|
154 |
+
$message = str_replace( '[post_password]', $post->post_password, $message );
|
155 |
+
$message = str_replace( '[post_name]', $post->post_name, $message );
|
156 |
+
$message = str_replace( '[to_ping]', $post->to_ping, $message );
|
157 |
+
$message = str_replace( '[pinged]', $post->pinged, $message );
|
158 |
+
$message = str_replace( '[post_modified]', $post->post_modified, $message );
|
159 |
+
$message = str_replace( '[post_modified_gmt]', $post->post_modified_gmt, $message );
|
160 |
+
$message = str_replace( '[post_content_filtered]', $post->post_content_filtered, $message );
|
161 |
+
$message = str_replace( '[post_parent]', $post->post_parent, $message );
|
162 |
+
$message = str_replace( '[guid]', $post->guid, $message );
|
163 |
+
$message = str_replace( '[menu_order]', $post->menu_order, $message );
|
164 |
+
$message = str_replace( '[post_type]', $post->post_type, $message );
|
165 |
+
$message = str_replace( '[post_mime_type]', $post->post_mime_type, $message );
|
166 |
+
$message = str_replace( '[comment_count]', $post->comment_count, $message );
|
167 |
+
|
168 |
+
$category_list = implode( ',', wp_get_post_categories( $post_id, array( 'fields' => 'names' ) ) );
|
169 |
+
$message = str_replace( '[post_category]', $category_list, $message );
|
170 |
+
|
171 |
+
$tag_list = implode( ',', wp_get_post_tags( $post_id, array( 'fields' => 'names' ) ) );
|
172 |
$message = str_replace( '[post_tag]', $tag_list, $message );
|
173 |
|
174 |
+
return $message;
|
175 |
+
}
|
176 |
+
|
177 |
+
/**
|
178 |
+
* Handle comment shortcodes.
|
179 |
+
*
|
180 |
+
* @since 1.0
|
181 |
+
* @param unknown $message
|
182 |
+
* @param unknown $comment_id
|
183 |
+
* @return unknown
|
184 |
+
*/
|
185 |
+
private function comment_shortcodes( $message, $comment_id ) {
|
186 |
+
$comment = get_comment( $comment_id );
|
187 |
+
|
188 |
+
$message = str_replace( '[comment_ID]', $comment->comment_ID, $message );
|
189 |
+
$message = str_replace( '[comment_post_ID]', $comment->comment_post_ID, $message );
|
190 |
+
$message = str_replace( '[comment_author]', $comment->comment_author, $message );
|
191 |
+
$message = str_replace( '[comment_author_email]', $comment->comment_author_email, $message );
|
192 |
+
$message = str_replace( '[comment_author_url]', $comment->comment_author_url, $message );
|
193 |
+
$message = str_replace( '[comment_author_IP]', $comment->comment_author_IP, $message );
|
194 |
+
$message = str_replace( '[comment_date]', $comment->comment_date, $message );
|
195 |
+
$message = str_replace( '[comment_date_gmt]', $comment->comment_date_gmt, $message );
|
196 |
+
$message = str_replace( '[comment_content]', get_comment_text( $comment->comment_ID ), $message );
|
197 |
+
$message = str_replace( '[comment_karma]', $comment->comment_karma, $message );
|
198 |
+
$message = str_replace( '[comment_approved]', str_replace( array( '0', '1', 'spam' ), array( 'awaiting moderation', 'approved', 'spam' ), $comment->comment_approved ), $message );
|
199 |
+
$message = str_replace( '[comment_agent]', $comment->comment_agent, $message );
|
200 |
+
$message = str_replace( '[comment_type]', $comment->comment_type, $message );
|
201 |
+
$message = str_replace( '[comment_parent]', $comment->comment_parent, $message );
|
202 |
+
$message = str_replace( '[user_id]', $comment->user_id, $message );
|
203 |
+
|
204 |
+
return $message;
|
205 |
+
}
|
206 |
+
|
207 |
+
/**
|
208 |
+
* Handle user shortcodes.
|
209 |
+
*
|
210 |
+
* @access private
|
211 |
+
* @since 1.0
|
212 |
+
* @param unknown $message
|
213 |
+
* @param unknown $user_id
|
214 |
+
* @return unknown
|
215 |
+
*/
|
216 |
+
private function user_shortcodes( $message, $user_id ) {
|
217 |
+
$user_info = get_userdata( $user_id );
|
218 |
+
|
219 |
+
$message = str_replace( '[ID]', $user_info->ID, $message );
|
220 |
+
$message = str_replace( '[user_login]', $user_info->user_login, $message );
|
221 |
+
$message = str_replace( '[user_nicename]', $user_info->user_nicename, $message );
|
222 |
+
$message = str_replace( '[user_email]', $user_info->user_email, $message );
|
223 |
+
$message = str_replace( '[user_url]', $user_info->user_url, $message );
|
224 |
+
$message = str_replace( '[user_registered]', $user_info->user_registered, $message );
|
225 |
+
$message = str_replace( '[display_name]', $user_info->display_name, $message );
|
226 |
+
$message = str_replace( '[user_firstname]', $user_info->user_firstname, $message );
|
227 |
+
$message = str_replace( '[user_lastname]', $user_info->user_lastname, $message );
|
228 |
+
$message = str_replace( '[nickname]', $user_info->nickname, $message );
|
229 |
+
$message = str_replace( '[user_description]', $user_info->user_description, $message );
|
230 |
+
if ( is_array( $user_info->wp_capabilities ) ) {
|
231 |
+
$message = str_replace( '[wp_capabilities]', implode( ',', $user_info->wp_capabilities ), $message );
|
232 |
+
}
|
233 |
+
$message = str_replace( '[admin_color]', $user_info->admin_color, $message );
|
234 |
+
$message = str_replace( '[closedpostboxes_page]', $user_info->closedpostboxes_page, $message );
|
235 |
+
$message = str_replace( '[rich_editing]', $user_info->rich_editing, $message );
|
236 |
+
|
237 |
+
return $message;
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* Handle taxonomy shortcodes.
|
242 |
+
*
|
243 |
+
* @access private
|
244 |
+
* @since 1.1
|
245 |
+
* @param string $message
|
246 |
+
* @param string $taxonomy
|
247 |
+
* @param int $term_id
|
248 |
+
* @return string
|
249 |
+
*/
|
250 |
+
private function taxonomy_shortcodes( $message, $taxonomy, $term_id ) {
|
251 |
+
$term_info = get_term( $term_id, $taxonomy );
|
252 |
+
|
253 |
+
$message = str_replace( '[slug]', $term_info->slug, $message );
|
254 |
+
$message = str_replace( '[name]', $term_info->name, $message );
|
255 |
+
$message = str_replace( '[description]', $term_info->description, $message );
|
256 |
+
|
257 |
+
return $message;
|
258 |
+
}
|
259 |
+
|
260 |
+
/**
|
261 |
+
* Get the list of emails from the notification settings.
|
262 |
+
*
|
263 |
+
* @since 1.0
|
264 |
+
* @param unknown $setting
|
265 |
+
* @return unknown
|
266 |
+
*/
|
267 |
+
private function get_emails( $setting ) {
|
268 |
+
$emails = array();
|
269 |
+
if ( ! empty( $setting['from-name'] ) && ! empty( $setting['from-email'] ) ) {
|
270 |
+
$emails['from'] = $setting['from-name'] . ' <' . $setting['from-email'] . '>' ;
|
271 |
+
} else {
|
272 |
+
$emails['from'] = get_option( 'blogname' ) . ' <' . get_option( 'admin_email' ) . '>' ;
|
273 |
+
}
|
274 |
+
|
275 |
+
if ( ! empty( $setting['users'] ) ) {
|
276 |
+
$emails['to'] = $this->get_emails_from_id( $setting['users'] );
|
277 |
+
} else {
|
278 |
+
$emails['to'] = $this->get_emails_from_role( $setting['user-roles'] );
|
279 |
+
}
|
280 |
+
|
281 |
+
$emails['cc'] = $this->get_emails_from_role( $setting['cc-roles'] );
|
282 |
+
if ( ! empty( $setting['cc-email'] ) ) {
|
283 |
+
$emails['cc'][] = $setting['cc-email'];
|
284 |
+
}
|
285 |
+
|
286 |
+
$emails['bcc'] = $this->get_emails_from_role( $setting['bcc-roles'] );
|
287 |
+
if ( ! empty( $setting['bcc-email'] ) ) {
|
288 |
+
$emails['bcc'][] = $setting['bcc-email'];
|
289 |
+
}
|
290 |
+
|
291 |
+
return $emails;
|
292 |
+
}
|
293 |
+
|
294 |
+
/**
|
295 |
+
* Get user emails by user ids.
|
296 |
+
*
|
297 |
+
* @since 1.0
|
298 |
+
* @param mixed $user_ids
|
299 |
+
* @return unknown
|
300 |
+
*/
|
301 |
+
private function get_emails_from_id( $user_ids ) {
|
302 |
+
$email_list = array();
|
303 |
+
$user_query = new WP_User_Query( array( 'include' => $user_ids ) );
|
304 |
+
foreach ( $user_query->results as $user ) {
|
305 |
+
$email_list[] = $user->user_email;
|
306 |
+
}
|
307 |
+
return $email_list;
|
308 |
+
}
|
309 |
+
|
310 |
+
/**
|
311 |
+
* Get emails of users based on role.
|
312 |
+
*
|
313 |
+
* @since 1.0
|
314 |
+
* @param unknown $roles
|
315 |
+
* @return unknown
|
316 |
+
*/
|
317 |
+
private function get_emails_from_role( $roles ) {
|
318 |
+
if ( ! is_array( $roles ) ) {
|
319 |
+
$roles = array( $roles );
|
320 |
+
}
|
321 |
+
|
322 |
+
$email_list = array();
|
323 |
+
foreach ( $roles as $role ) {
|
324 |
+
$role_name = $this->get_role_name_by_label( $role );
|
325 |
+
$users = get_users( array(
|
326 |
+
'role' => $role_name,
|
327 |
+
'fields' => array( 'user_email' ),
|
328 |
+
) );
|
329 |
+
|
330 |
+
foreach ( $users as $user ) {
|
331 |
+
$email_list[] = $user->user_email;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
return $email_list;
|
336 |
+
}
|
337 |
+
|
338 |
+
/**
|
339 |
+
* Get User role name by label.
|
340 |
+
*
|
341 |
+
* @param mixed $role_label
|
342 |
+
* @return unknown
|
343 |
+
*/
|
344 |
+
protected function get_role_name_by_label( $role_label ) {
|
345 |
+
global $wp_roles;
|
346 |
+
foreach ( $wp_roles->roles as $role_name => $role_info ) {
|
347 |
+
if ( $role_label == $role_info['name'] ) {
|
348 |
+
return $role_name;
|
349 |
+
}
|
350 |
+
}
|
351 |
+
|
352 |
+
// There is something wrong
|
353 |
+
return '';
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Generate email headers based on the emails.
|
358 |
+
*
|
359 |
+
* @since 1.0
|
360 |
+
* @param unknown $emails
|
361 |
+
* @return unknown
|
362 |
+
*/
|
363 |
+
private function get_headers( $emails ) {
|
364 |
+
$headers = array();
|
365 |
+
return $headers;
|
366 |
+
|
367 |
+
$headers[] = 'From:' . $emails['from'];
|
368 |
+
if ( ! empty( $emails['cc'] ) ) {
|
369 |
+
$headers[] = 'Cc:' . implode( ',', $emails['cc'] );
|
370 |
+
}
|
371 |
+
if ( ! empty( $emails['bcc'] ) ) {
|
372 |
+
$headers[] = 'Bcc:' . implode( ',', $emails['bcc'] );
|
373 |
+
}
|
374 |
+
}
|
375 |
}
|
376 |
?>
|
includes/import.php
CHANGED
@@ -4,149 +4,153 @@
|
|
4 |
*
|
5 |
* @since 1.0
|
6 |
*/
|
|
|
7 |
class BNFW_Import {
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
111 |
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
|
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
}
|
152 |
?>
|
4 |
*
|
5 |
* @since 1.0
|
6 |
*/
|
7 |
+
|
8 |
class BNFW_Import {
|
9 |
+
const EMAIL_OPTION = 'bnfw_custom_email_settings';
|
10 |
+
const SETTING_OPTION = 'bnfw_settings';
|
11 |
+
private $events = array( 'create_term', 'publish_post', 'comment_post', 'user_register', 'trackback_post', 'pingback_post', 'lostpassword_post' );
|
12 |
|
13 |
+
/**
|
14 |
+
* Import notification from old plugin.
|
15 |
+
*
|
16 |
+
* @since 1.0
|
17 |
+
*/
|
18 |
+
public function import() {
|
19 |
+
global $wp_roles;
|
20 |
+
$roles = $wp_roles->get_names();
|
21 |
|
22 |
+
if ( $this->import_needed() ) {
|
23 |
+
$old_events = get_option( self::SETTING_OPTION );
|
24 |
+
foreach ( $old_events as $event => $value ) {
|
25 |
+
if ( '1' == $value ) {
|
26 |
+
$event_array = explode( '-', $event );
|
27 |
+
if ( 2 == count( $event_array ) ) {
|
28 |
+
if ( in_array( $event_array[0], $this->events ) && in_array( $event_array[1], array_keys( $roles ) ) ) {
|
29 |
+
$event_array[1] = $roles[$event_array[1]];
|
30 |
+
$this->insert_notification( $event_array );
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
// delete the old options
|
36 |
+
$this->delete_option();
|
37 |
+
}
|
38 |
+
}
|
39 |
|
40 |
+
/**
|
41 |
+
* Check if import is needed.
|
42 |
+
*
|
43 |
+
* @since 1.0
|
44 |
+
* @return unknown
|
45 |
+
*/
|
46 |
+
private function import_needed() {
|
47 |
+
if ( get_option( self::EMAIL_OPTION ) && get_option( self::SETTING_OPTION ) ) {
|
48 |
+
return true;
|
49 |
+
}
|
50 |
+
return false;
|
51 |
+
}
|
52 |
|
53 |
+
/**
|
54 |
+
* Insert notification.
|
55 |
+
*
|
56 |
+
* @param mixed $event
|
57 |
+
*/
|
58 |
+
private function insert_notification( $event ) {
|
59 |
+
$post = array(
|
60 |
+
'post_title' => $event[0] . __( ' for ', 'bnfw' ) . $event[1] . __( ' (Auto Imported)', 'bnfw' ),
|
61 |
+
'post_type' => BNFW_Notification::POST_TYPE,
|
62 |
+
'post_content' => '',
|
63 |
+
'post_status' => 'publish',
|
64 |
+
);
|
65 |
|
66 |
+
$post_id = wp_insert_post( $post );
|
67 |
+
if ( $post_id > 0 ) {
|
68 |
+
$content = $this->map_notification_content( $event[0] );
|
69 |
+
$setting = array(
|
70 |
+
'notification' => $this->map_notification( $event[0] ),
|
71 |
+
'user-roles' => array( $event[1] ),
|
72 |
+
'users' => array(),
|
73 |
+
'subject' => $content['subject'],
|
74 |
+
'message' => $content['body'],
|
75 |
+
);
|
76 |
|
77 |
+
foreach ( $setting as $key => $value ) {
|
78 |
+
update_post_meta( $post_id, BNFW_Notification::META_KEY_PREFIX . $key, $value );
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
|
83 |
+
/**
|
84 |
+
* Map old notification type to new notification type.
|
85 |
+
*
|
86 |
+
* @param mixed $event_name
|
87 |
+
* @return unknown
|
88 |
+
*/
|
89 |
+
private function map_notification( $event_name ) {
|
90 |
+
switch ( $event_name ) {
|
91 |
+
case 'create_term':
|
92 |
+
return 'new-category';
|
93 |
+
break;
|
94 |
+
case 'publish_post':
|
95 |
+
return 'new-post';
|
96 |
+
break;
|
97 |
+
case 'comment_post':
|
98 |
+
return 'new-comment';
|
99 |
+
break;
|
100 |
+
case 'user_register':
|
101 |
+
return 'new-user';
|
102 |
+
break;
|
103 |
+
case 'trackback_post':
|
104 |
+
return 'new-trackback';
|
105 |
+
break;
|
106 |
+
case 'pingback_post':
|
107 |
+
return 'new-pingback';
|
108 |
+
break;
|
109 |
+
case 'lostpassword_post':
|
110 |
+
return 'user-password';
|
111 |
+
break;
|
112 |
+
}
|
113 |
+
}
|
114 |
|
115 |
+
/**
|
116 |
+
* Map content from old plugin.
|
117 |
+
*
|
118 |
+
* @param unknown $event_name
|
119 |
+
* @return unknown
|
120 |
+
*/
|
121 |
+
private function map_notification_content( $event_name ) {
|
122 |
+
$content = array();
|
123 |
+
if ( ! isset( $this->content_map ) ) {
|
124 |
+
$this->parse_content();
|
125 |
+
}
|
126 |
+
return $this->content_map[$event_name];
|
127 |
+
}
|
128 |
|
129 |
+
/**
|
130 |
+
* Parse content from old plugins setting.
|
131 |
+
*
|
132 |
+
* @since 1.0
|
133 |
+
*/
|
134 |
+
private function parse_content() {
|
135 |
+
$old_content = get_option( self::EMAIL_OPTION );
|
136 |
+
$content_map = array();
|
137 |
+
foreach ( $old_content as $key => $value ) {
|
138 |
+
$key_array = explode( '-', $key );
|
139 |
+
if ( 3 == count( $key_array ) ) {
|
140 |
+
$content_map[$key_array[2]][$key_array[1]] = $value;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
$this->content_map = $content_map;
|
144 |
+
}
|
145 |
|
146 |
+
/**
|
147 |
+
* Delete old plugin database options.
|
148 |
+
*
|
149 |
+
* @since 1.0
|
150 |
+
*/
|
151 |
+
private function delete_option() {
|
152 |
+
delete_option( self::EMAIL_OPTION );
|
153 |
+
delete_option( self::SETTING_OPTION );
|
154 |
+
}
|
155 |
}
|
156 |
?>
|
includes/overrides.php
CHANGED
@@ -1,46 +1,50 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
*
|
4 |
-
*
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
$
|
27 |
-
|
28 |
-
|
29 |
-
$headers = '';
|
30 |
-
$attachments = array ();
|
31 |
-
return compact('to', 'subject', 'message', 'headers', 'attachments');
|
32 |
}
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
$message = '';
|
37 |
-
$headers = '';
|
38 |
-
$attachments = array ();
|
39 |
-
return compact('to', 'subject', 'message', 'headers', 'attachments');
|
40 |
}
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
|
|
|
|
|
|
|
46 |
?>
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Override default WordPress emails
|
4 |
+
*
|
5 |
+
*/
|
6 |
|
7 |
+
/**
|
8 |
+
* Email login credentials to a newly-registered user.
|
9 |
+
*
|
10 |
+
* A new user registration notification is also sent to admin email.
|
11 |
+
*
|
12 |
+
* @param int $user_id User ID.
|
13 |
+
* @param string $plaintext_pass (optional) Optional. The user's plaintext password. Default empty.
|
14 |
+
*/
|
15 |
+
if ( ! function_exists( 'wp_new_user_notification' ) ) {
|
16 |
+
function wp_new_user_notification( $user_id, $plaintext_pass = '' ) {
|
17 |
+
$bnfw = BNFW::factory();
|
18 |
+
$user = get_userdata( $user_id );
|
19 |
+
|
20 |
+
// The blogname option is escaped with esc_html on the way into the database in sanitize_option
|
21 |
+
// we want to reverse this for the plain text arena of emails.
|
22 |
+
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
23 |
+
|
24 |
+
if ( ! $bnfw->notifier->notification_exists( 'admin-user' ) ) {
|
25 |
+
$message = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
|
26 |
+
$message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
|
27 |
+
$message .= sprintf( __( 'E-mail: %s' ), $user->user_email ) . "\r\n";
|
28 |
+
|
29 |
+
@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), $blogname ), $message );
|
|
|
|
|
|
|
30 |
}
|
31 |
+
|
32 |
+
if ( empty( $plaintext_pass ) ) {
|
33 |
+
return;
|
|
|
|
|
|
|
|
|
34 |
}
|
35 |
|
36 |
+
if ( $bnfw->notifier->notification_exists( 'new-user' ) ) {
|
37 |
+
$notifications = $bnfw->notifier->get_notifications( 'new-user' );
|
38 |
+
foreach ( $notifications as $notification ) {
|
39 |
+
$bnfw->engine->send_registration_email( $bnfw->notifier->read_settings( $notification->ID ), $user, $plaintext_pass );
|
40 |
+
}
|
41 |
+
} else {
|
42 |
+
$message = sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n";
|
43 |
+
$message .= sprintf( __( 'Password: %s' ), $plaintext_pass ) . "\r\n";
|
44 |
+
$message .= wp_login_url() . "\r\n";
|
45 |
|
46 |
+
wp_mail( $user->user_email, sprintf( __( '[%s] Your username and password' ), $blogname ), $message );
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
?>
|
languages/bnfw.pot
CHANGED
@@ -1,236 +1,313 @@
|
|
1 |
-
# Copyright (C)
|
2 |
# This file is distributed under the same license as the Better Notifications for WordPress package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Better Notifications for WordPress 1.
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/bnfw\n"
|
7 |
-
"POT-Creation-Date:
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
-
"PO-Revision-Date:
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
-
#: includes/admin/bnfw-settings.php:
|
16 |
-
#: includes/admin/class-bnfw-notification.php:
|
17 |
msgid "Notification Settings"
|
18 |
msgstr ""
|
19 |
|
20 |
-
#: includes/admin/bnfw-settings.php:
|
21 |
msgid "Settings"
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: includes/admin/bnfw-settings.php:
|
25 |
msgid "BNFW Settings"
|
26 |
msgstr ""
|
27 |
|
28 |
-
#: includes/admin/bnfw-settings.php:
|
29 |
msgid "Suppress SPAM comment notification"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: includes/admin/bnfw-settings.php:
|
33 |
msgid "Don't send notifications for comments marked as SPAM by Akismet"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: includes/admin/bnfw-settings.php:171
|
37 |
-
msgid "Notification Name"
|
38 |
-
msgstr ""
|
39 |
-
|
40 |
-
#: includes/admin/bnfw-settings.php:180
|
41 |
-
#: includes/admin/class-bnfw-notification.php:230
|
42 |
-
#: includes/admin/class-bnfw-notification.php:527
|
43 |
-
msgid "User Roles"
|
44 |
-
msgstr ""
|
45 |
-
|
46 |
-
#: includes/admin/bnfw-settings.php:189
|
47 |
-
msgid "User"
|
48 |
-
msgstr ""
|
49 |
-
|
50 |
-
#: includes/admin/bnfw-settings.php:247
|
51 |
-
msgid ""
|
52 |
-
"Do you want to specify individual users from the user roles selected above?"
|
53 |
-
msgstr ""
|
54 |
-
|
55 |
-
#: includes/admin/class-bnfw-notification.php:39
|
56 |
-
#: includes/admin/class-bnfw-notification.php:42
|
57 |
#: includes/admin/class-bnfw-notification.php:43
|
|
|
|
|
58 |
msgid "Notifications"
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: includes/admin/class-bnfw-notification.php:
|
62 |
msgid "Notification"
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: includes/admin/class-bnfw-notification.php:
|
66 |
msgid "Add New"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: includes/admin/class-bnfw-notification.php:
|
70 |
msgid "Add New Notification"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: includes/admin/class-bnfw-notification.php:
|
74 |
msgid "Edit Notification"
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: includes/admin/class-bnfw-notification.php:
|
78 |
msgid "New Notification"
|
79 |
msgstr ""
|
80 |
|
81 |
-
#: includes/admin/class-bnfw-notification.php:
|
82 |
msgid "View Notification"
|
83 |
msgstr ""
|
84 |
|
85 |
-
#: includes/admin/class-bnfw-notification.php:
|
86 |
msgid "Search Notifications"
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: includes/admin/class-bnfw-notification.php:
|
90 |
msgid "No Notifications found"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: includes/admin/class-bnfw-notification.php:
|
94 |
msgid "No Notifications found in trash"
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: includes/admin/class-bnfw-notification.php:
|
98 |
msgid "All Notifications"
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: includes/admin/class-bnfw-notification.php:
|
102 |
msgid "Save Notification"
|
103 |
msgstr ""
|
104 |
|
105 |
-
#: includes/admin/class-bnfw-notification.php:
|
106 |
msgid "Notification For"
|
107 |
msgstr ""
|
108 |
|
109 |
-
#: includes/admin/class-bnfw-notification.php:
|
110 |
msgid "New Comment / Awaiting Moderation"
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: includes/admin/class-bnfw-notification.php:
|
|
|
114 |
msgid "New Trackback"
|
115 |
msgstr ""
|
116 |
|
117 |
-
#: includes/admin/class-bnfw-notification.php:
|
|
|
118 |
msgid "New Pingback"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: includes/admin/class-bnfw-notification.php:
|
122 |
-
|
|
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: includes/admin/class-bnfw-notification.php:
|
126 |
-
msgid "New User Registration"
|
127 |
msgstr ""
|
128 |
|
129 |
-
#: includes/admin/class-bnfw-notification.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
msgid "New Post Published"
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: includes/admin/class-bnfw-notification.php:
|
|
|
134 |
msgid "Post Updated"
|
135 |
msgstr ""
|
136 |
|
137 |
-
#: includes/admin/class-bnfw-notification.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
msgid "New Category"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: includes/admin/class-bnfw-notification.php:
|
|
|
|
|
|
|
|
|
|
|
142 |
msgid "Custom Post Type - "
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: includes/admin/class-bnfw-notification.php:
|
|
|
146 |
msgid "New "
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: includes/admin/class-bnfw-notification.php:
|
150 |
msgid "Update "
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: includes/admin/class-bnfw-notification.php:
|
154 |
-
msgid "
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: includes/admin/class-bnfw-notification.php:
|
158 |
msgid "Custom Taxonomy"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: includes/admin/class-bnfw-notification.php:
|
162 |
-
msgid "New
|
163 |
-
msgstr ""
|
164 |
-
|
165 |
-
#: includes/admin/class-bnfw-notification.php:196
|
166 |
-
msgid "From Name and Email"
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: includes/admin/class-bnfw-notification.php:
|
170 |
-
msgid "
|
|
|
|
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: includes/admin/class-bnfw-notification.php:
|
174 |
-
msgid "
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: includes/admin/class-bnfw-notification.php:
|
178 |
msgid "Define individual users instead"
|
179 |
msgstr ""
|
180 |
|
181 |
-
#: includes/admin/class-bnfw-notification.php:
|
182 |
msgid "Define user roles instead"
|
183 |
msgstr ""
|
184 |
|
185 |
-
#: includes/admin/class-bnfw-notification.php:
|
186 |
-
#: includes/admin/class-bnfw-notification.php:
|
187 |
msgid "Subject"
|
188 |
msgstr ""
|
189 |
|
190 |
-
#: includes/admin/class-bnfw-notification.php:
|
191 |
msgid "Message Body"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: includes/admin/class-bnfw-notification.php:
|
195 |
msgid "Notification saved."
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: includes/admin/class-bnfw-notification.php:
|
199 |
-
#: includes/admin/class-bnfw-notification.php:
|
200 |
-
#: includes/admin/class-bnfw-notification.php:
|
201 |
msgid "Save"
|
202 |
msgstr ""
|
203 |
|
204 |
-
#: includes/admin/class-bnfw-notification.php:
|
|
|
|
|
|
|
|
|
205 |
msgid "Delete Permanently"
|
206 |
msgstr ""
|
207 |
|
208 |
-
#: includes/admin/class-bnfw-notification.php:
|
209 |
msgid "Move to Trash"
|
210 |
msgstr ""
|
211 |
|
212 |
-
#: includes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
msgid " for "
|
214 |
msgstr ""
|
215 |
|
216 |
-
#: includes/import.php:
|
217 |
msgid " (Auto Imported)"
|
218 |
msgstr ""
|
219 |
|
220 |
-
#: includes/overrides.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
msgid "[%s] New User Registration"
|
222 |
msgstr ""
|
223 |
|
224 |
-
#: includes/overrides.php:
|
225 |
-
msgid "
|
226 |
msgstr ""
|
227 |
|
228 |
-
#: includes/overrides.php:
|
229 |
-
msgid "[%s]
|
230 |
msgstr ""
|
231 |
|
232 |
-
#: includes/
|
233 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
msgstr ""
|
235 |
|
236 |
#. Plugin Name of the plugin/theme
|
@@ -243,8 +320,8 @@ msgstr ""
|
|
243 |
|
244 |
#. Description of the plugin/theme
|
245 |
msgid ""
|
246 |
-
"
|
247 |
-
"
|
248 |
msgstr ""
|
249 |
|
250 |
#. Author of the plugin/theme
|
1 |
+
# Copyright (C) 2015 Better Notifications for WordPress
|
2 |
# This file is distributed under the same license as the Better Notifications for WordPress package.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Better Notifications for WordPress 1.1\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/tag/bnfw\n"
|
7 |
+
"POT-Creation-Date: 2015-03-16 16:17:54+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
|
12 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
13 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14 |
|
15 |
+
#: includes/admin/bnfw-settings.php:14
|
16 |
+
#: includes/admin/class-bnfw-notification.php:117
|
17 |
msgid "Notification Settings"
|
18 |
msgstr ""
|
19 |
|
20 |
+
#: includes/admin/bnfw-settings.php:15
|
21 |
msgid "Settings"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: includes/admin/bnfw-settings.php:36
|
25 |
msgid "BNFW Settings"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: includes/admin/bnfw-settings.php:72
|
29 |
msgid "Suppress SPAM comment notification"
|
30 |
msgstr ""
|
31 |
|
32 |
+
#: includes/admin/bnfw-settings.php:77
|
33 |
msgid "Don't send notifications for comments marked as SPAM by Akismet"
|
34 |
msgstr ""
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
#: includes/admin/class-bnfw-notification.php:43
|
37 |
+
#: includes/admin/class-bnfw-notification.php:46
|
38 |
+
#: includes/admin/class-bnfw-notification.php:47
|
39 |
msgid "Notifications"
|
40 |
msgstr ""
|
41 |
|
42 |
+
#: includes/admin/class-bnfw-notification.php:44
|
43 |
msgid "Notification"
|
44 |
msgstr ""
|
45 |
|
46 |
+
#: includes/admin/class-bnfw-notification.php:45
|
47 |
msgid "Add New"
|
48 |
msgstr ""
|
49 |
|
50 |
+
#: includes/admin/class-bnfw-notification.php:48
|
51 |
msgid "Add New Notification"
|
52 |
msgstr ""
|
53 |
|
54 |
+
#: includes/admin/class-bnfw-notification.php:49
|
55 |
msgid "Edit Notification"
|
56 |
msgstr ""
|
57 |
|
58 |
+
#: includes/admin/class-bnfw-notification.php:50
|
59 |
msgid "New Notification"
|
60 |
msgstr ""
|
61 |
|
62 |
+
#: includes/admin/class-bnfw-notification.php:51
|
63 |
msgid "View Notification"
|
64 |
msgstr ""
|
65 |
|
66 |
+
#: includes/admin/class-bnfw-notification.php:52
|
67 |
msgid "Search Notifications"
|
68 |
msgstr ""
|
69 |
|
70 |
+
#: includes/admin/class-bnfw-notification.php:53
|
71 |
msgid "No Notifications found"
|
72 |
msgstr ""
|
73 |
|
74 |
+
#: includes/admin/class-bnfw-notification.php:54
|
75 |
msgid "No Notifications found in trash"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: includes/admin/class-bnfw-notification.php:55
|
79 |
msgid "All Notifications"
|
80 |
msgstr ""
|
81 |
|
82 |
+
#: includes/admin/class-bnfw-notification.php:125
|
83 |
msgid "Save Notification"
|
84 |
msgstr ""
|
85 |
|
86 |
+
#: includes/admin/class-bnfw-notification.php:154
|
87 |
msgid "Notification For"
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: includes/admin/class-bnfw-notification.php:159
|
91 |
msgid "New Comment / Awaiting Moderation"
|
92 |
msgstr ""
|
93 |
|
94 |
+
#: includes/admin/class-bnfw-notification.php:160
|
95 |
+
#: includes/admin/class-bnfw-notification.php:630
|
96 |
msgid "New Trackback"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: includes/admin/class-bnfw-notification.php:161
|
100 |
+
#: includes/admin/class-bnfw-notification.php:633
|
101 |
msgid "New Pingback"
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: includes/admin/class-bnfw-notification.php:162
|
105 |
+
#: includes/admin/class-bnfw-notification.php:639
|
106 |
+
msgid "Lost Password - For Admin"
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: includes/admin/class-bnfw-notification.php:163
|
110 |
+
msgid "New User Registration - For Admin"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: includes/admin/class-bnfw-notification.php:166
|
114 |
+
#: includes/admin/class-bnfw-notification.php:636
|
115 |
+
msgid "Lost Password - For User"
|
116 |
+
msgstr ""
|
117 |
+
|
118 |
+
#: includes/admin/class-bnfw-notification.php:167
|
119 |
+
msgid "New User Registration - For User"
|
120 |
+
msgstr ""
|
121 |
+
|
122 |
+
#: includes/admin/class-bnfw-notification.php:168
|
123 |
+
msgid "New User - Welcome Email"
|
124 |
+
msgstr ""
|
125 |
+
|
126 |
+
#: includes/admin/class-bnfw-notification.php:171
|
127 |
+
#: includes/admin/class-bnfw-notification.php:651
|
128 |
msgid "New Post Published"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: includes/admin/class-bnfw-notification.php:172
|
132 |
+
#: includes/admin/class-bnfw-notification.php:654
|
133 |
msgid "Post Updated"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: includes/admin/class-bnfw-notification.php:173
|
137 |
+
#: includes/admin/class-bnfw-notification.php:657
|
138 |
+
msgid "Post Pending Review"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: includes/admin/class-bnfw-notification.php:174
|
142 |
+
#: includes/admin/class-bnfw-notification.php:660
|
143 |
msgid "New Category"
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: includes/admin/class-bnfw-notification.php:175
|
147 |
+
#: includes/admin/class-bnfw-notification.php:663
|
148 |
+
msgid "New Tag"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: includes/admin/class-bnfw-notification.php:188
|
152 |
msgid "Custom Post Type - "
|
153 |
msgstr ""
|
154 |
|
155 |
+
#: includes/admin/class-bnfw-notification.php:189
|
156 |
+
#: includes/admin/class-bnfw-notification.php:669
|
157 |
msgid "New "
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: includes/admin/class-bnfw-notification.php:190
|
161 |
msgid "Update "
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: includes/admin/class-bnfw-notification.php:191
|
165 |
+
msgid "Pending Review"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: includes/admin/class-bnfw-notification.php:207
|
169 |
msgid "Custom Taxonomy"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: includes/admin/class-bnfw-notification.php:208
|
173 |
+
msgid "New"
|
|
|
|
|
|
|
|
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: includes/admin/class-bnfw-notification.php:222
|
177 |
+
msgid ""
|
178 |
+
"This notification doesn't support additional email fields or shortcodes in "
|
179 |
+
"the subject line"
|
180 |
msgstr ""
|
181 |
|
182 |
+
#: includes/admin/class-bnfw-notification.php:229
|
183 |
+
msgid "User Roles"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: includes/admin/class-bnfw-notification.php:252
|
187 |
msgid "Define individual users instead"
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: includes/admin/class-bnfw-notification.php:268
|
191 |
msgid "Define user roles instead"
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: includes/admin/class-bnfw-notification.php:275
|
195 |
+
#: includes/admin/class-bnfw-notification.php:574
|
196 |
msgid "Subject"
|
197 |
msgstr ""
|
198 |
|
199 |
+
#: includes/admin/class-bnfw-notification.php:284
|
200 |
msgid "Message Body"
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: includes/admin/class-bnfw-notification.php:456
|
204 |
msgid "Notification saved."
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: includes/admin/class-bnfw-notification.php:474
|
208 |
+
#: includes/admin/class-bnfw-notification.php:502
|
209 |
+
#: includes/admin/class-bnfw-notification.php:503
|
210 |
msgid "Save"
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: includes/admin/class-bnfw-notification.php:484
|
214 |
+
msgid "Disable Notification"
|
215 |
+
msgstr ""
|
216 |
+
|
217 |
+
#: includes/admin/class-bnfw-notification.php:492
|
218 |
msgid "Delete Permanently"
|
219 |
msgstr ""
|
220 |
|
221 |
+
#: includes/admin/class-bnfw-notification.php:494
|
222 |
msgid "Move to Trash"
|
223 |
msgstr ""
|
224 |
|
225 |
+
#: includes/admin/class-bnfw-notification.php:572
|
226 |
+
msgid "Notification Type"
|
227 |
+
msgstr ""
|
228 |
+
|
229 |
+
#: includes/admin/class-bnfw-notification.php:573
|
230 |
+
msgid "Enabled?"
|
231 |
+
msgstr ""
|
232 |
+
|
233 |
+
#: includes/admin/class-bnfw-notification.php:575
|
234 |
+
msgid "User Roles/Users"
|
235 |
+
msgstr ""
|
236 |
+
|
237 |
+
#: includes/admin/class-bnfw-notification.php:627
|
238 |
+
msgid "New Comment"
|
239 |
+
msgstr ""
|
240 |
+
|
241 |
+
#: includes/admin/class-bnfw-notification.php:642
|
242 |
+
msgid "User Registration - For User"
|
243 |
+
msgstr ""
|
244 |
+
|
245 |
+
#: includes/admin/class-bnfw-notification.php:645
|
246 |
+
msgid "New User - Welcome email"
|
247 |
+
msgstr ""
|
248 |
+
|
249 |
+
#: includes/admin/class-bnfw-notification.php:648
|
250 |
+
msgid "User Registration - For Admin"
|
251 |
+
msgstr ""
|
252 |
+
|
253 |
+
#: includes/admin/class-bnfw-notification.php:672
|
254 |
+
msgid "Updated "
|
255 |
+
msgstr ""
|
256 |
+
|
257 |
+
#: includes/admin/class-bnfw-notification.php:675
|
258 |
+
msgid " Pending Review"
|
259 |
+
msgstr ""
|
260 |
+
|
261 |
+
#: includes/import.php:60
|
262 |
msgid " for "
|
263 |
msgstr ""
|
264 |
|
265 |
+
#: includes/import.php:60
|
266 |
msgid " (Auto Imported)"
|
267 |
msgstr ""
|
268 |
|
269 |
+
#: includes/overrides.php:25
|
270 |
+
msgid "New user registration on your site %s:"
|
271 |
+
msgstr ""
|
272 |
+
|
273 |
+
#: includes/overrides.php:26 includes/overrides.php:42
|
274 |
+
msgid "Username: %s"
|
275 |
+
msgstr ""
|
276 |
+
|
277 |
+
#: includes/overrides.php:27
|
278 |
+
msgid "E-mail: %s"
|
279 |
+
msgstr ""
|
280 |
+
|
281 |
+
#: includes/overrides.php:29
|
282 |
msgid "[%s] New User Registration"
|
283 |
msgstr ""
|
284 |
|
285 |
+
#: includes/overrides.php:43
|
286 |
+
msgid "Password: %s"
|
287 |
msgstr ""
|
288 |
|
289 |
+
#: includes/overrides.php:46
|
290 |
+
msgid "[%s] Your username and password"
|
291 |
msgstr ""
|
292 |
|
293 |
+
#: includes/tmp.php:3
|
294 |
+
msgid "Additional Email Fields"
|
295 |
+
msgstr ""
|
296 |
+
|
297 |
+
#: includes/tmp.php:7
|
298 |
+
msgid "Show additional email fields"
|
299 |
+
msgstr ""
|
300 |
+
|
301 |
+
#: includes/tmp.php:13
|
302 |
+
msgid "From Name and Email"
|
303 |
+
msgstr ""
|
304 |
+
|
305 |
+
#: includes/tmp.php:23
|
306 |
+
msgid "CC"
|
307 |
+
msgstr ""
|
308 |
+
|
309 |
+
#: includes/tmp.php:34
|
310 |
+
msgid "BCC"
|
311 |
msgstr ""
|
312 |
|
313 |
#. Plugin Name of the plugin/theme
|
320 |
|
321 |
#. Description of the plugin/theme
|
322 |
msgid ""
|
323 |
+
"Send customisable HTML emails to your users for different WordPress "
|
324 |
+
"notifications."
|
325 |
msgstr ""
|
326 |
|
327 |
#. Author of the plugin/theme
|