Last active
January 11, 2016 05:19
-
-
Save afragen/5624319 to your computer and use it in GitHub Desktop.
Uses the hook new_user_approve_user_denied in the New User Approve WP plugin to delete denied users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: New User Approve - Delete Deny | |
GitHub Plugin URI: https://gist.github.com/afragen/5624319 | |
Description: This plugin hooks into 'new_user_approve_user_denied' to delete the denied new user. | |
Requires at least: 3.1 | |
Tested up to: 3.6.1 | |
Version: 1.0.1 | |
Author: Andy Fragen | |
Author URI: http://thefragens.com/blog/ | |
License: GNU General Public License v2 | |
License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | |
*/ | |
add_action( 'admin_notices', 'nuadd_fail_msg' ); | |
function nuadd_fail_msg() { | |
if ( !class_exists( 'pw_new_user_approve' ) ) { | |
if ( current_user_can( 'activate_plugins' ) && is_admin() ) { | |
$url = 'http://wordpress.org/plugins/new-user-approve/'; | |
$title = __( 'New User Approve' ); | |
echo '<div class="error"><p>'.sprintf( __( 'To begin using New User Approve - Delete Deny, please install the latest version of <a href="%s" class="thickbox" title="%s">New User Approve</a>.' ),$url, $title ).'</p></div>'; | |
} | |
} | |
} | |
add_action( 'new_user_approve_user_denied', 'nuadd_delete_user' ); | |
function nuadd_delete_user ( $user ) { | |
global $wpdb; | |
require_once( ABSPATH . '/wp-admin/includes/user.php'); | |
wp_delete_user( $user->ID ); | |
} | |
add_filter( 'new_user_approve_bypass_password_reset', '__return_false' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment