Version Description
Download this release
Release Info
| Developer | picklewagon |
| Plugin | |
| Version | 1.1.2 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.1 to 1.1.2
- new-user-approve.php +45 -22
- readme.txt +2 -2
new-user-approve.php
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve
|
| 5 |
Description: This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog.
|
| 6 |
Author: Josh Harrison
|
| 7 |
-
Version: 1.1.
|
| 8 |
Author URI: http://www.picklewagon.com/
|
| 9 |
*/
|
| 10 |
|
|
@@ -144,13 +144,16 @@ if (!class_exists('pw_new_user_approve')) {
|
|
| 144 |
return $links;
|
| 145 |
}
|
| 146 |
|
| 147 |
-
function admin_scripts_footer() {
|
| 148 |
-
|
|
|
|
|
|
|
|
|
|
| 149 |
?>
|
| 150 |
<script type="text/javascript">
|
| 151 |
//<![CDATA[
|
| 152 |
jQuery(document).ready(function($) {
|
| 153 |
-
$('
|
| 154 |
});
|
| 155 |
//]]>
|
| 156 |
</script>
|
|
@@ -188,7 +191,9 @@ if (!class_exists('pw_new_user_approve')) {
|
|
| 188 |
/**
|
| 189 |
* @desc create the view for the admin interface
|
| 190 |
*/
|
| 191 |
-
function approve_admin() {
|
|
|
|
|
|
|
| 192 |
// Query the users table
|
| 193 |
$wp_user_search = new PW_User_Search($_GET['usersearch'], $_GET['userspage']);
|
| 194 |
$user_status = array();
|
|
@@ -267,16 +272,27 @@ if (!class_exists('pw_new_user_approve')) {
|
|
| 267 |
$class = ($row % 2) ? '' : ' class="alternate"';
|
| 268 |
$avatar = get_avatar( $user->user_email, 32 );
|
| 269 |
if ($approve) {
|
| 270 |
-
$approve_link =
|
| 271 |
$approve_link = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($approve_link, 'plugin-name-action_' . get_class($this)) : $approve_link;
|
| 272 |
}
|
| 273 |
if ($deny) {
|
| 274 |
-
$deny_link =
|
| 275 |
$deny_link = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($deny_link, 'plugin-name-action_' . get_class($this)) : $deny_link;
|
| 276 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 277 |
?><tr <?php echo $class; ?>>
|
| 278 |
<td><?php echo $user->ID; ?></td>
|
| 279 |
-
<td><?php echo $avatar." ".$
|
| 280 |
<td><?php echo $user->first_name." ".$user->last_name; ?></td>
|
| 281 |
<td><a href="mailto:<?php echo $user->user_email; ?>" title="email: <?php echo $user->user_email; ?>"><?php echo $user->user_email; ?></a></td>
|
| 282 |
<?php if ($approve) { ?>
|
|
@@ -308,13 +324,13 @@ if (!class_exists('pw_new_user_approve')) {
|
|
| 308 |
$errors->add('registration_required' , __("User name already exists"), 'message');
|
| 309 |
} else {
|
| 310 |
/* send email to admin for approval */
|
| 311 |
-
$message = __($user_login.' ('.$user_email.') has requested a username at '.
|
| 312 |
$message .= get_option('siteurl') . "\r\n\r\n";
|
| 313 |
-
$message .= __('To approve or deny this user access to '.
|
| 314 |
-
$message .=
|
| 315 |
|
| 316 |
// send the mail
|
| 317 |
-
@wp_mail(
|
| 318 |
|
| 319 |
// create the user
|
| 320 |
$user_pass = wp_generate_password();
|
|
@@ -345,13 +361,13 @@ if (!class_exists('pw_new_user_approve')) {
|
|
| 345 |
$user_email = stripslashes($user->user_email);
|
| 346 |
|
| 347 |
// format the message
|
| 348 |
-
$message = sprintf(__('You have been approved to access %s '."\r\n"),
|
| 349 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
|
| 350 |
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
|
| 351 |
-
$message .=
|
| 352 |
|
| 353 |
// send the mail
|
| 354 |
-
@wp_mail($user_email, sprintf(__('[%s] Registration Approved'),
|
| 355 |
|
| 356 |
// change usermeta tag in database to approved
|
| 357 |
update_usermeta($user->ID, 'pw_user_status', 'approved');
|
|
@@ -370,10 +386,10 @@ if (!class_exists('pw_new_user_approve')) {
|
|
| 370 |
$user_email = stripslashes($user->user_email);
|
| 371 |
|
| 372 |
// format the message
|
| 373 |
-
$message = sprintf(__('You have been denied access to %s'),
|
| 374 |
|
| 375 |
// send the mail
|
| 376 |
-
@wp_mail($user_email, sprintf(__('[%s] Registration Denied'),
|
| 377 |
|
| 378 |
// change usermeta tag in database to denied
|
| 379 |
update_usermeta($user->ID, 'pw_user_status', 'denied');
|
|
@@ -419,9 +435,16 @@ if (!class_exists('pw_new_user_approve')) {
|
|
| 419 |
/**
|
| 420 |
* @desc only give a user their password if they have been approved
|
| 421 |
*/
|
| 422 |
-
function lost_password() {
|
| 423 |
-
$
|
| 424 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
if ($user_data->pw_user_status != 'approved') {
|
| 426 |
wp_redirect('wp-login.php');
|
| 427 |
exit();
|
|
@@ -432,7 +455,7 @@ if (!class_exists('pw_new_user_approve')) {
|
|
| 432 |
|
| 433 |
function welcome_user($message) {
|
| 434 |
if (!isset($_GET['action'])) {
|
| 435 |
-
$message .= '<p class="message">Welcome to
|
| 436 |
}
|
| 437 |
|
| 438 |
if ($_GET['action'] == 'register' && !$_POST) {
|
| 4 |
Plugin URI: http://www.picklewagon.com/wordpress/new-user-approve
|
| 5 |
Description: This plugin allows administrators to approve users once they register. Only approved users will be allowed to access the blog.
|
| 6 |
Author: Josh Harrison
|
| 7 |
+
Version: 1.1.2
|
| 8 |
Author URI: http://www.picklewagon.com/
|
| 9 |
*/
|
| 10 |
|
| 144 |
return $links;
|
| 145 |
}
|
| 146 |
|
| 147 |
+
function admin_scripts_footer() {
|
| 148 |
+
global $wp_db_version;
|
| 149 |
+
|
| 150 |
+
if($_GET['page'] == basename(__FILE__)) {
|
| 151 |
+
$page_id = ($wp_db_version >= 10851) ? '#pw_approve_tabs' : '#pw_approve_tabs > ul';
|
| 152 |
?>
|
| 153 |
<script type="text/javascript">
|
| 154 |
//<![CDATA[
|
| 155 |
jQuery(document).ready(function($) {
|
| 156 |
+
$('<?php echo $page_id; ?>').tabs({ fx: { opacity: 'toggle' } });
|
| 157 |
});
|
| 158 |
//]]>
|
| 159 |
</script>
|
| 191 |
/**
|
| 192 |
* @desc create the view for the admin interface
|
| 193 |
*/
|
| 194 |
+
function approve_admin() {
|
| 195 |
+
global $current_user;
|
| 196 |
+
|
| 197 |
// Query the users table
|
| 198 |
$wp_user_search = new PW_User_Search($_GET['usersearch'], $_GET['userspage']);
|
| 199 |
$user_status = array();
|
| 272 |
$class = ($row % 2) ? '' : ' class="alternate"';
|
| 273 |
$avatar = get_avatar( $user->user_email, 32 );
|
| 274 |
if ($approve) {
|
| 275 |
+
$approve_link = get_option('siteurl').'/wp-admin/users.php?page='.basename(__FILE__).'&user='.$user->ID.'&status=approve';
|
| 276 |
$approve_link = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($approve_link, 'plugin-name-action_' . get_class($this)) : $approve_link;
|
| 277 |
}
|
| 278 |
if ($deny) {
|
| 279 |
+
$deny_link = get_option('siteurl').'/wp-admin/users.php?page='.basename(__FILE__).'&user='.$user->ID.'&status=deny';
|
| 280 |
$deny_link = ( function_exists('wp_nonce_url') ) ? wp_nonce_url($deny_link, 'plugin-name-action_' . get_class($this)) : $deny_link;
|
| 281 |
+
}
|
| 282 |
+
if ( current_user_can( 'edit_user', $user->ID ) ) {
|
| 283 |
+
if ($current_user->ID == $user->ID) {
|
| 284 |
+
$edit_link = 'profile.php';
|
| 285 |
+
} else {
|
| 286 |
+
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( esc_url( stripslashes( $_SERVER['REQUEST_URI'] ) ) ), "user-edit.php?user_id=$user->ID" ) );
|
| 287 |
+
}
|
| 288 |
+
$edit = "<strong><a href=\"$edit_link\">$user->user_login</a></strong><br />";
|
| 289 |
+
} else {
|
| 290 |
+
$edit = '<strong>' . $user->user_login . '</strong>';
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
?><tr <?php echo $class; ?>>
|
| 294 |
<td><?php echo $user->ID; ?></td>
|
| 295 |
+
<td><?php echo $avatar." ".$edit; ?></td>
|
| 296 |
<td><?php echo $user->first_name." ".$user->last_name; ?></td>
|
| 297 |
<td><a href="mailto:<?php echo $user->user_email; ?>" title="email: <?php echo $user->user_email; ?>"><?php echo $user->user_email; ?></a></td>
|
| 298 |
<?php if ($approve) { ?>
|
| 324 |
$errors->add('registration_required' , __("User name already exists"), 'message');
|
| 325 |
} else {
|
| 326 |
/* send email to admin for approval */
|
| 327 |
+
$message = __($user_login.' ('.$user_email.') has requested a username at '.get_option('blogname')) . "\r\n\r\n";
|
| 328 |
$message .= get_option('siteurl') . "\r\n\r\n";
|
| 329 |
+
$message .= __('To approve or deny this user access to '.get_option('blogname'). ' go to') . "\r\n\r\n";
|
| 330 |
+
$message .= get_option('siteurl') . "/wp-admin/users.php?page=".basename(__FILE__)."\r\n";
|
| 331 |
|
| 332 |
// send the mail
|
| 333 |
+
@wp_mail(get_option('admin_email'), sprintf(__('[%s] User Approval'), get_option('blogname')), $message);
|
| 334 |
|
| 335 |
// create the user
|
| 336 |
$user_pass = wp_generate_password();
|
| 361 |
$user_email = stripslashes($user->user_email);
|
| 362 |
|
| 363 |
// format the message
|
| 364 |
+
$message = sprintf(__('You have been approved to access %s '."\r\n"), get_option('blogname'));
|
| 365 |
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n";
|
| 366 |
$message .= sprintf(__('Password: %s'), $new_pass) . "\r\n";
|
| 367 |
+
$message .= get_option('siteurl') . "/wp-login.php\r\n";
|
| 368 |
|
| 369 |
// send the mail
|
| 370 |
+
@wp_mail($user_email, sprintf(__('[%s] Registration Approved'), get_option('blogname')), $message);
|
| 371 |
|
| 372 |
// change usermeta tag in database to approved
|
| 373 |
update_usermeta($user->ID, 'pw_user_status', 'approved');
|
| 386 |
$user_email = stripslashes($user->user_email);
|
| 387 |
|
| 388 |
// format the message
|
| 389 |
+
$message = sprintf(__('You have been denied access to %s'), get_option('blogname'));
|
| 390 |
|
| 391 |
// send the mail
|
| 392 |
+
@wp_mail($user_email, sprintf(__('[%s] Registration Denied'), get_option('blogname')), $message);
|
| 393 |
|
| 394 |
// change usermeta tag in database to denied
|
| 395 |
update_usermeta($user->ID, 'pw_user_status', 'denied');
|
| 435 |
/**
|
| 436 |
* @desc only give a user their password if they have been approved
|
| 437 |
*/
|
| 438 |
+
function lost_password() {
|
| 439 |
+
$is_email = strpos($_POST['user_login'], '@');
|
| 440 |
+
if ($is_email === false) {
|
| 441 |
+
$username = sanitize_user($_POST['user_login']);
|
| 442 |
+
$user_data = get_userdatabylogin(trim($username));
|
| 443 |
+
} else {
|
| 444 |
+
$email = is_email($_POST['user_login']);
|
| 445 |
+
$user_data = get_user_by_email($email);
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
if ($user_data->pw_user_status != 'approved') {
|
| 449 |
wp_redirect('wp-login.php');
|
| 450 |
exit();
|
| 455 |
|
| 456 |
function welcome_user($message) {
|
| 457 |
if (!isset($_GET['action'])) {
|
| 458 |
+
$message .= '<p class="message">Welcome to '.get_option('blogname').'. This site is accessible to approved users only. To be approved, you must first register.</p>';
|
| 459 |
}
|
| 460 |
|
| 461 |
if ($_GET['action'] == 'register' && !$_POST) {
|
readme.txt
CHANGED
|
@@ -3,8 +3,8 @@ Contributors: picklewagon
|
|
| 3 |
Donate link: http://www.picklewagon.com/wordpress/
|
| 4 |
Tags: users, registration
|
| 5 |
Requires at least: 2.5
|
| 6 |
-
Tested up to: 2.
|
| 7 |
-
Stable tag: 1.1.
|
| 8 |
|
| 9 |
New User Approve is a Wordpress plugin that allows a blog administrator to
|
| 10 |
approve a user before they are able to access and login to the blog.
|
| 3 |
Donate link: http://www.picklewagon.com/wordpress/
|
| 4 |
Tags: users, registration
|
| 5 |
Requires at least: 2.5
|
| 6 |
+
Tested up to: 2.8
|
| 7 |
+
Stable tag: 1.1.2
|
| 8 |
|
| 9 |
New User Approve is a Wordpress plugin that allows a blog administrator to
|
| 10 |
approve a user before they are able to access and login to the blog.
|
