Version Description
- add filter for link to approve/deny users
- add filter for adding more email addresses to get notifications
- fix bug that prevents users to be approved and denied when requested
- fix bug that prevents the new user email from including a password
- fix bug that prevents search results from showing when searching users
Download this release
Release Info
Developer | picklewagon |
Plugin | New User Approve |
Version | 1.5.3 |
Comparing to | |
See all releases |
Code changes from version 1.5.2 to 1.5.3
- includes/user-list.php +1 -4
- new-user-approve.php +37 -20
- readme.txt +11 -1
includes/user-list.php
CHANGED
@@ -45,9 +45,6 @@ class pw_new_user_approve_user_list {
|
|
45 |
* @uses load-users.php
|
46 |
*/
|
47 |
public function update_action() {
|
48 |
-
if ( isset( $_GET['new_user_approve_filter'] ) )
|
49 |
-
return;
|
50 |
-
|
51 |
if ( isset( $_GET['action'] ) && ( in_array( $_GET['action'], array( 'approve', 'deny' ) ) ) ) {
|
52 |
check_admin_referer( 'new-user-approve' );
|
53 |
|
@@ -188,7 +185,7 @@ class pw_new_user_approve_user_list {
|
|
188 |
if ( 'users' != $screen->id )
|
189 |
return;
|
190 |
|
191 |
-
if ( isset( $_GET['new_user_approve_filter'] ) ) {
|
192 |
$filter = esc_attr( $_GET['new_user_approve_filter'] );
|
193 |
|
194 |
$query->query_from .= " INNER JOIN {$wpdb->usermeta} wp_usermeta ON ( {$wpdb->users}.ID = wp_usermeta.user_id )";
|
45 |
* @uses load-users.php
|
46 |
*/
|
47 |
public function update_action() {
|
|
|
|
|
|
|
48 |
if ( isset( $_GET['action'] ) && ( in_array( $_GET['action'], array( 'approve', 'deny' ) ) ) ) {
|
49 |
check_admin_referer( 'new-user-approve' );
|
50 |
|
185 |
if ( 'users' != $screen->id )
|
186 |
return;
|
187 |
|
188 |
+
if ( isset( $_GET['new_user_approve_filter'] ) && $_GET['new_user_approve_filter'] != '' ) {
|
189 |
$filter = esc_attr( $_GET['new_user_approve_filter'] );
|
190 |
|
191 |
$query->query_from .= " INNER JOIN {$wpdb->usermeta} wp_usermeta ON ( {$wpdb->users}.ID = wp_usermeta.user_id )";
|
new-user-approve.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve/
|
5 |
Description: Allow administrators to approve users once they register. Only approved users will be allowed to access the blog. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
|
6 |
Author: Josh Harrison
|
7 |
-
Version: 1.5.
|
8 |
Author URI: http://www.picklewagon.com/
|
9 |
*/
|
10 |
|
@@ -38,7 +38,6 @@ class pw_new_user_approve {
|
|
38 |
register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
|
39 |
|
40 |
// Actions
|
41 |
-
add_action( 'plugins_loaded', array( $this, 'include_files' ) );
|
42 |
add_action( 'wp_loaded', array( $this, 'admin_loaded' ) );
|
43 |
add_action( 'rightnow_end', array( $this, 'dashboard_stats' ) );
|
44 |
add_action( 'user_register', array( $this, 'delete_new_user_approve_transient' ), 11 );
|
@@ -92,27 +91,22 @@ class pw_new_user_approve {
|
|
92 |
do_action( 'new_user_approve_deactivate' );
|
93 |
}
|
94 |
|
95 |
-
/**
|
96 |
-
* Include any external files as part of the plugin.
|
97 |
-
*
|
98 |
-
* @uses plugins_loaded
|
99 |
-
*/
|
100 |
-
public function include_files() {
|
101 |
-
require_once( dirname( __FILE__ ) . '/includes/admin-approve.php' );
|
102 |
-
}
|
103 |
-
|
104 |
/**
|
105 |
* Makes it possible to disable the user admin integration. Must happen after
|
106 |
-
*
|
107 |
*
|
108 |
* @uses wp_loaded
|
109 |
*/
|
110 |
public function admin_loaded() {
|
111 |
$user_admin_integration = apply_filters( 'new_user_approve_user_admin_integration', true );
|
112 |
-
|
113 |
if ( $user_admin_integration ) {
|
114 |
require_once( dirname( __FILE__ ) . '/includes/user-list.php' );
|
115 |
}
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
/**
|
@@ -151,6 +145,7 @@ class pw_new_user_approve {
|
|
151 |
|
152 |
// where it all happens
|
153 |
do_action( 'new_user_approve_' . $status . '_user', $user_id );
|
|
|
154 |
}
|
155 |
|
156 |
/**
|
@@ -303,6 +298,20 @@ class pw_new_user_approve {
|
|
303 |
<?php
|
304 |
}
|
305 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
306 |
/**
|
307 |
* Send an email to the admin to request approval. If there are already errors,
|
308 |
* just go back and let core do it's thing.
|
@@ -321,19 +330,28 @@ class pw_new_user_approve {
|
|
321 |
// we want to reverse this for the plain text arena of emails.
|
322 |
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
323 |
|
|
|
|
|
|
|
324 |
/* send email to admin for approval */
|
325 |
-
$message
|
326 |
-
|
327 |
-
$message
|
328 |
-
$message
|
|
|
|
|
|
|
329 |
|
330 |
$message = apply_filters( 'new_user_approve_request_approval_message', $message, $user_login, $user_email );
|
331 |
|
332 |
$subject = sprintf( __( '[%s] User Approval', 'new-user-approve' ), $blogname );
|
333 |
$subject = apply_filters( 'new_user_approve_request_approval_subject', $subject );
|
334 |
|
|
|
|
|
|
|
335 |
// send the mail
|
336 |
-
wp_mail(
|
337 |
}
|
338 |
|
339 |
/**
|
@@ -391,7 +409,7 @@ class pw_new_user_approve {
|
|
391 |
$bypass_password_reset = true;
|
392 |
|
393 |
// if the password has already been reset, absolutely bypass
|
394 |
-
if ( empty( $password_reset ) )
|
395 |
$bypass_password_reset = true;
|
396 |
|
397 |
$bypass_password_reset = apply_filters( 'new_user_approve_bypass_password_reset', $bypass_password_reset );
|
@@ -482,7 +500,6 @@ class pw_new_user_approve {
|
|
482 |
$from_name = get_option( 'blogname' );
|
483 |
|
484 |
$headers = array(
|
485 |
-
"MIME-Version: 1.0\n",
|
486 |
"From: \"{$from_name}\" <{$admin_email}>\n",
|
487 |
"Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n",
|
488 |
);
|
4 |
Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve/
|
5 |
Description: Allow administrators to approve users once they register. Only approved users will be allowed to access the blog. For support, please go to the <a href="http://wordpress.org/support/plugin/new-user-approve">support forums</a> on wordpress.org.
|
6 |
Author: Josh Harrison
|
7 |
+
Version: 1.5.3
|
8 |
Author URI: http://www.picklewagon.com/
|
9 |
*/
|
10 |
|
38 |
register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
|
39 |
|
40 |
// Actions
|
|
|
41 |
add_action( 'wp_loaded', array( $this, 'admin_loaded' ) );
|
42 |
add_action( 'rightnow_end', array( $this, 'dashboard_stats' ) );
|
43 |
add_action( 'user_register', array( $this, 'delete_new_user_approve_transient' ), 11 );
|
91 |
do_action( 'new_user_approve_deactivate' );
|
92 |
}
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
/**
|
95 |
* Makes it possible to disable the user admin integration. Must happen after
|
96 |
+
* WordPress is loaded.
|
97 |
*
|
98 |
* @uses wp_loaded
|
99 |
*/
|
100 |
public function admin_loaded() {
|
101 |
$user_admin_integration = apply_filters( 'new_user_approve_user_admin_integration', true );
|
|
|
102 |
if ( $user_admin_integration ) {
|
103 |
require_once( dirname( __FILE__ ) . '/includes/user-list.php' );
|
104 |
}
|
105 |
+
|
106 |
+
$legacy_panel = apply_filters( 'new_user_approve_user_admin_legacy', true );
|
107 |
+
if ( $legacy_panel ) {
|
108 |
+
require_once( dirname( __FILE__ ) . '/includes/admin-approve.php' );
|
109 |
+
}
|
110 |
}
|
111 |
|
112 |
/**
|
145 |
|
146 |
// where it all happens
|
147 |
do_action( 'new_user_approve_' . $status . '_user', $user_id );
|
148 |
+
do_action( 'new_user_approve_user_status_update', $user_id, $status );
|
149 |
}
|
150 |
|
151 |
/**
|
298 |
<?php
|
299 |
}
|
300 |
|
301 |
+
/**
|
302 |
+
* The default notification message that is sent to site admin when requesting approval.
|
303 |
+
*
|
304 |
+
* @return string
|
305 |
+
*/
|
306 |
+
public function default_notification_message() {
|
307 |
+
$message = __( 'USERNAME (USEREMAIL) has requested a username at SITENAME', 'new-user-approve' ) . "\n\n";
|
308 |
+
$message .= "SITEURL\n\n";
|
309 |
+
$message .= __( 'To approve or deny this user access to SITENAME go to', 'new-user-approve' ) . "\n\n";
|
310 |
+
$message .= "ADMINURL\n\n";
|
311 |
+
|
312 |
+
return $message;
|
313 |
+
}
|
314 |
+
|
315 |
/**
|
316 |
* Send an email to the admin to request approval. If there are already errors,
|
317 |
* just go back and let core do it's thing.
|
330 |
// we want to reverse this for the plain text arena of emails.
|
331 |
$blogname = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
|
332 |
|
333 |
+
$default_admin_url = admin_url( 'users.php?s&pw-status-query-submit=Filter&new_user_approve_filter=pending&paged=1' );
|
334 |
+
$admin_url = apply_filters( 'new_user_approve_admin_link', $default_admin_url );
|
335 |
+
|
336 |
/* send email to admin for approval */
|
337 |
+
$message = apply_filters( 'new_user_approve_request_approval_message_default', $this->default_notification_message() );
|
338 |
+
|
339 |
+
$message = str_replace( 'USERNAME', $user_login, $message );
|
340 |
+
$message = str_replace( 'USEREMAIL', $user_email, $message );
|
341 |
+
$message = str_replace( 'SITENAME', $blogname, $message );
|
342 |
+
$message = str_replace( 'SITEURL', get_option( 'siteurl' ), $message );
|
343 |
+
$message = str_replace( 'ADMINURL', $admin_url, $message );
|
344 |
|
345 |
$message = apply_filters( 'new_user_approve_request_approval_message', $message, $user_login, $user_email );
|
346 |
|
347 |
$subject = sprintf( __( '[%s] User Approval', 'new-user-approve' ), $blogname );
|
348 |
$subject = apply_filters( 'new_user_approve_request_approval_subject', $subject );
|
349 |
|
350 |
+
$to = apply_filters( 'new_user_approve_email_admins', get_option( 'admin_email' ) );
|
351 |
+
$to = array_unique( $to );
|
352 |
+
|
353 |
// send the mail
|
354 |
+
wp_mail( $to, $subject, $message, $this->email_message_headers() );
|
355 |
}
|
356 |
|
357 |
/**
|
409 |
$bypass_password_reset = true;
|
410 |
|
411 |
// if the password has already been reset, absolutely bypass
|
412 |
+
if ( !empty( $password_reset ) )
|
413 |
$bypass_password_reset = true;
|
414 |
|
415 |
$bypass_password_reset = apply_filters( 'new_user_approve_bypass_password_reset', $bypass_password_reset );
|
500 |
$from_name = get_option( 'blogname' );
|
501 |
|
502 |
$headers = array(
|
|
|
503 |
"From: \"{$from_name}\" <{$admin_email}>\n",
|
504 |
"Content-Type: text/plain; charset=\"" . get_option( 'blog_charset' ) . "\"\n",
|
505 |
);
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://picklewagon.com/wordpress/new-user-approve/donate
|
|
4 |
Tags: users, registration, sign up, user management
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 3.6
|
7 |
-
Stable tag: 1.5.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -68,6 +68,13 @@ this feature.
|
|
68 |
|
69 |
== Changelog ==
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
= 1.5.2 =
|
72 |
* fix link to approve new users in email to admin
|
73 |
* fix bug with sending emails to new approved users
|
@@ -184,6 +191,9 @@ this feature.
|
|
184 |
|
185 |
== Upgrade Notice ==
|
186 |
|
|
|
|
|
|
|
187 |
= 1.5 =
|
188 |
A long awaited upgrade that includes better integration with WordPress core. Requires at least WordPress 3.5.
|
189 |
|
4 |
Tags: users, registration, sign up, user management
|
5 |
Requires at least: 3.5.1
|
6 |
Tested up to: 3.6
|
7 |
+
Stable tag: 1.5.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 1.5.3 =
|
72 |
+
* add filter for link to approve/deny users
|
73 |
+
* add filter for adding more email addresses to get notifications
|
74 |
+
* fix bug that prevents users to be approved and denied when requested
|
75 |
+
* fix bug that prevents the new user email from including a password
|
76 |
+
* fix bug that prevents search results from showing when searching users
|
77 |
+
|
78 |
= 1.5.2 =
|
79 |
* fix link to approve new users in email to admin
|
80 |
* fix bug with sending emails to new approved users
|
191 |
|
192 |
== Upgrade Notice ==
|
193 |
|
194 |
+
= 1.5.3 =
|
195 |
+
Download version 1.5.3 immediately! Some bugs have been fixed that have been affecting how the plugin worked.
|
196 |
+
|
197 |
= 1.5 =
|
198 |
A long awaited upgrade that includes better integration with WordPress core. Requires at least WordPress 3.5.
|
199 |
|