Manage Notification E-mails - Version 1.0.0

Version Description

Nothing for now.

Download this release

Release Info

Developer Virgial
Plugin Icon 128x128 Manage Notification E-mails
Version 1.0.0
Comparing to
See all releases

Version 1.0.0

includes/class.FAMNESettingsPage.php ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Manage notification emails settings page class
4
+ *
5
+ * Displays the settings page.
6
+ *
7
+ * This file is part of the Manage Notification Emails plugin
8
+ * You can find out more about this plugin at http://www.freeamigos.mx
9
+ * Copyright (c) 2006-2015 Virgial Berveling
10
+ *
11
+ * @package WordPress
12
+ * @author Virgial Berveling
13
+ * @copyright 2006-2015
14
+ *
15
+ * version: 1.0.0
16
+ */
17
+
18
+
19
+ class FAMNESettingsPage
20
+ {
21
+ /**
22
+ * Holds the values to be used in the fields callbacks
23
+ */
24
+ private $options;
25
+
26
+ /**
27
+ * Start up
28
+ */
29
+ public function __construct()
30
+ {
31
+ add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
32
+ add_action( 'admin_init', array( $this, 'page_init' ) );
33
+ }
34
+
35
+ /**
36
+ * Add options page
37
+ */
38
+ public function add_plugin_page()
39
+ {
40
+ // This page will be under "Settings"
41
+ add_options_page(
42
+ 'Settings Admin',
43
+ 'Notification e-mails',
44
+ 'manage_options',
45
+ 'famne-admin',
46
+ array( $this, 'create_admin_page' )
47
+ );
48
+ }
49
+
50
+ /**
51
+ * Options page callback
52
+ */
53
+ public function create_admin_page()
54
+ {
55
+ // Set class property
56
+ $this->options = get_option( 'famne_options' );
57
+
58
+ ?>
59
+ <div class="wrap">
60
+ <h2>Manage the notification e-mails</h2>
61
+ <form method="post" action="options.php">
62
+ <?php
63
+ // This prints out all hidden setting fields
64
+ settings_fields( 'famne_option_group' );
65
+ do_settings_sections( 'famne-admin' );
66
+ submit_button();
67
+ ?>
68
+ </form>
69
+ </div>
70
+ <?php
71
+ }
72
+
73
+ /**
74
+ * Register and add settings
75
+ */
76
+ public function page_init()
77
+ {
78
+ register_setting(
79
+ 'famne_option_group', // Option group
80
+ 'famne_options', // Option name
81
+ array( $this, 'sanitize' ) // Sanitize
82
+ );
83
+
84
+ add_settings_section(
85
+ 'setting_section_id', // ID
86
+ '', // Title
87
+ array( $this, 'print_section_info' ), // Callback
88
+ 'famne-admin' // Page
89
+ );
90
+
91
+ add_settings_field(
92
+ 'wp_new_user_notification', // ID
93
+ 'New user notification', // Title
94
+ array( $this, 'field1_callback' ), // Callback
95
+ 'famne-admin', // Page
96
+ 'setting_section_id' // Section
97
+ );
98
+
99
+ add_settings_field(
100
+ 'wp_notify_postauthor',
101
+ 'Notify postauthor',
102
+ array( $this, 'field2_callback' ),
103
+ 'famne-admin',
104
+ 'setting_section_id'
105
+ );
106
+
107
+ add_settings_field(
108
+ 'wp_notify_moderator',
109
+ 'Notify moderator',
110
+ array( $this, 'field3_callback' ),
111
+ 'famne-admin',
112
+ 'setting_section_id'
113
+ );
114
+
115
+ add_settings_field(
116
+ 'wp_password_change_notification',
117
+ 'Password change notification to admin',
118
+ array( $this, 'field4_callback' ),
119
+ 'famne-admin',
120
+ 'setting_section_id'
121
+ );
122
+
123
+ add_settings_field(
124
+ 'send_password_change_email',
125
+ 'Password change notification to user',
126
+ array( $this, 'field5_callback' ),
127
+ 'famne-admin',
128
+ 'setting_section_id'
129
+ );
130
+
131
+ add_settings_field(
132
+ 'send_email_change_email',
133
+ 'E-mailaddress change notification to user',
134
+ array( $this, 'field6_callback' ),
135
+ 'famne-admin',
136
+ 'setting_section_id'
137
+ );
138
+
139
+
140
+
141
+ }
142
+
143
+ /**
144
+ * Sanitize each setting field as needed
145
+ *
146
+ * @param array $input Contains all settings fields as array keys
147
+ */
148
+ public function sanitize( $input )
149
+ {
150
+ $new_input = array();
151
+ foreach( $input as $key=>$val )
152
+ $new_input[$key] = $val == '1'?'1':'';
153
+
154
+ return $new_input;
155
+ }
156
+
157
+ /**
158
+ * Print the Section text
159
+ */
160
+ public function print_section_info()
161
+ {
162
+ echo 'Set your settings below:';
163
+ }
164
+
165
+ /**
166
+ * Get the settings option array and print one of its values
167
+ */
168
+
169
+ public function print_checkbox($name,$id,$message='')
170
+ {
171
+ $checked = isset( $this->options[$id]) && $this->options[$id] =='1' ?'checked="checked"':'';
172
+
173
+
174
+ print '<label><input type="checkbox" id="'.$name.'" name="famne_options['.$id.']" value="1" '.$checked.' />'.$message.'</label>';
175
+ }
176
+
177
+
178
+ public function field1_callback()
179
+ {
180
+ $this->print_checkbox('field1','wp_new_user_notification','Email login credentials to a newly-registered user. A new user registration notification is also sent to admin email.');
181
+ }
182
+
183
+ public function field2_callback()
184
+ {
185
+ $this->print_checkbox('field2','wp_notify_postauthor','Notify an author (and/or others) of a comment/trackback/pingback on a post.');
186
+ }
187
+
188
+ public function field3_callback()
189
+ {
190
+ $this->print_checkbox('field3','wp_notify_moderator','Notifies the moderator of the blog about a new comment that is awaiting approval.');
191
+ }
192
+
193
+ public function field4_callback()
194
+ {
195
+ $this->print_checkbox('field4','wp_password_change_notification','Notify the blog admin of a user changing password, normally via email.');
196
+ }
197
+
198
+ public function field5_callback()
199
+ {
200
+ $this->print_checkbox('field5','send_password_change_email','Email password change notification to registered user. Be careful with this option, because when set, the forgotten password request e-mails will be blocked too.');
201
+ }
202
+
203
+ public function field6_callback()
204
+ {
205
+ $this->print_checkbox('field6','send_email_change_email','Email users e-mailaddress change notification to registered user.');
206
+ }
207
+
208
+
209
+ }
includes/pluggable-functions.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+ /**
5
+
6
+ STOP SENDING NOTIFICATION MAILS TO THE USERS
7
+
8
+ */
9
+
10
+
11
+ $famne_options = get_option( 'famne_options' );
12
+
13
+ if (empty($famne_options['send_password_change_email']) && !function_exists('dont_send_password_change_email') ) :
14
+ /**
15
+ * Email password change notification to registered user.
16
+ *
17
+ */
18
+ //echo "dont_send_password_change_email";
19
+ function dont_send_password_change_email( $send=false, $user='', $userdata='')
20
+ {
21
+ return false;
22
+ }
23
+ add_filter('send_password_change_email', 'dont_send_password_change_email',1,3);
24
+ endif;
25
+
26
+
27
+ if (empty($famne_options['send_email_change_email']) && !function_exists('dont_send_email_change_email') ) :
28
+ /**
29
+ * Email users e-mail change notification to registered user.
30
+ *
31
+ */
32
+ //echo "dont_send_email_change_email off";
33
+ function dont_send_email_change_email( $send=false, $user='', $userdata='')
34
+ {
35
+ return false;
36
+ }
37
+ add_filter('send_email_change_email', 'dont_send_email_change_email',1,3);
38
+ endif;
39
+
40
+
41
+
42
+ if (empty($famne_options['wp_new_user_notification']) && !function_exists('wp_new_user_notification') ) :
43
+ /**
44
+ * Email login credentials to a newly-registered user.
45
+ *
46
+ * A new user registration notification is also sent to admin email.
47
+ */
48
+ //echo "wp_new_user_notification off";
49
+ function wp_new_user_notification( $user_id, $notify = '' ) { }
50
+ endif;
51
+
52
+ if (empty($famne_options['wp_notify_postauthor']) && !function_exists('wp_notify_postauthor') ) :
53
+ /**
54
+ * Notify an author (and/or others) of a comment/trackback/pingback on a post.
55
+ */
56
+ //echo "wp_notify_postauthor off";
57
+ function wp_notify_postauthor( $comment_id, $deprecated = null ) {}
58
+ endif;
59
+
60
+ if (empty($famne_options['wp_notify_moderator']) && !function_exists('wp_notify_moderator') ) :
61
+ /**
62
+ * Notifies the moderator of the blog about a new comment that is awaiting approval.
63
+ */
64
+ //echo "wp_notify_moderator off";
65
+ function wp_notify_moderator($comment_id) {}
66
+ endif;
67
+
68
+
69
+ if (empty($famne_options['wp_password_change_notification']) && !function_exists('wp_password_change_notification') ) :
70
+ /**
71
+ * Notify the blog admin of a user changing password, normally via email.
72
+ */
73
+ //echo "wp_password_change_notification off";
74
+ function wp_password_change_notification($user) {}
75
+ endif;
76
+
index.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php // there is nothing to see here! ?>
manage-notification-emails.php ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Manage Notification E-mails
4
+ Plugin URI: http://www.freeamigos.mx/wp-plugins/manage-notification-emails/1.0.0
5
+ Description: This plugin gives you the option to disable some of the notification e-mails send by Wordpress. It's a simple plugin but effective.
6
+
7
+
8
+ Version: 1.0.0
9
+ Author: Virgial Berveling
10
+ Author URI: http://www.freeamigos.mx
11
+ License: GPLv2
12
+ */
13
+
14
+
15
+ /*
16
+ Copyright (c) 2006-2015 Chad Butler
17
+
18
+ The name WP-Members(tm) is a trademark of butlerblog.com
19
+
20
+ This program is free software; you can redistribute it and/or modify
21
+ it under the terms of the GNU General Public License, version 2, as
22
+ published by the Free Software Foundation.
23
+
24
+ This program is distributed in the hope that it will be useful,
25
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
26
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
+ GNU General Public License for more details.
28
+
29
+ You should have received a copy of the GNU General Public License
30
+ along with this program; if not, write to the Free Software
31
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32
+
33
+ You may also view the license here:
34
+ http://www.gnu.org/licenses/gpl.html
35
+ */
36
+
37
+
38
+ /*
39
+ A NOTE ABOUT LICENSE:
40
+
41
+ While this plugin is freely available and open-source under the GPL2
42
+ license, that does not mean it is "public domain." You are free to modify
43
+ and redistribute as long as you comply with the license. Any derivative
44
+ work MUST be GPL licensed and available as open source. You also MUST give
45
+ proper attribution to the original author, copyright holder, and trademark
46
+ owner. This means you cannot change two lines of code and claim copyright
47
+ of the entire work as your own. The GPL2 license requires that if you
48
+ modify this code, you must clearly indicate what section(s) you have
49
+ modified and you may only claim copyright of your modifications and not
50
+ the body of work. If you are unsure or have questions about how a
51
+ derivative work you are developing complies with the license, copyright,
52
+ trademark, or if you do not understand the difference between
53
+ open source and public domain, contact the original author at:
54
+ http://www.freeamigos.mx/contact/.
55
+
56
+
57
+ INSTALLATION PROCEDURE:
58
+
59
+ Just put it in your plugins directory.
60
+ */
61
+
62
+
63
+ define( 'FA_MNE_VERSION', '1.0.0' );
64
+ define( 'FA_MNE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
65
+ define( 'FA_MNE_PLUGIN_DIR', untrailingslashit( dirname( __FILE__ ) ) );
66
+
67
+
68
+ /**
69
+ * Initialize the plugin.
70
+ *
71
+ * @since 1.0.0
72
+ */
73
+
74
+
75
+ function famne_init() {
76
+
77
+ if (is_admin()) :
78
+
79
+ include_once( FA_MNE_PLUGIN_DIR . '/includes/class.FAMNESettingsPage.php' );
80
+ $fa_MNESettingsPage = new FAMNESettingsPage();
81
+ endif;
82
+ }
83
+
84
+
85
+ include_once( FA_MNE_PLUGIN_DIR . '/includes/pluggable-functions.php' );
86
+
87
+ famne_init();
88
+
readme.txt ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Plugin Name ===
2
+ Contributors: (Virgial)
3
+ Tags: notifications, email
4
+ Requires at least: 4.0.0
5
+ Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TYG56SLWNG42N
6
+ Tested up to: 4.3
7
+ Stable tag: 1.0.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ This plugin gives you the option to disable some of the notification e-mails send by Wordpress. It's a simple plugin but effective.
12
+
13
+ == Description ==
14
+
15
+ This plugin gives you the option to disable some of the notification e-mails send by Wordpress. It's a simple plugin but effective.
16
+ The options you can manage are:
17
+
18
+ - New user notification
19
+ - Notify postauthor
20
+ - Notify moderator
21
+ - Password change notification to admin
22
+ - Password change notification to user
23
+ - E-mailaddress change notification to user
24
+
25
+ == Installation ==
26
+
27
+ 1. Upload `manage-notification-emails.zip` via the plugins menu
28
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
29
+
30
+
31
+ == Frequently Asked Questions ==
32
+
33
+ = Is it active right away? =
34
+
35
+ No. Just go to the settings page and disable or enable the notifications that suits you.
36
+
37
+
38
+ == Screenshots ==
39
+
40
+ 1. This is your view of the settingspage. It's not much but hopefully enough for you.
41
+
42
+ == Upgrade Notice ==
43
+ Nothing for now.
44
+
45
+ == Changelog ==
46
+
47
+ = 1.0 =
48
+ * It all starts here.
screen-1.png ADDED
Binary file