Yes. The full answer is here in the codex: http://codex.wordpress.org/Plugin_API/Action_Reference/delete_user
So I won’t repost its code.
function my_delete_user($user_id) {
global $wpdb;
$email = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE ID = '" . $user_id . "' LIMIT 1");
$headers="From: " . get_bloginfo("name") . ' <' . get_bloginfo("admin_email") . '>' . "\r\n";
wp_mail($email, 'You are being deleted, brah', 'Your account at ' . get_bloginfo("name") . ' is being deleted right now.', $headers);
}
add_action( 'delete_user', 'my_delete_user');
Related Posts:
- Add email addresses to already registered users
- how can i inform other users about new user registration? [closed]
- get_user_meta() doesn’t include user email?
- Confirmation required on email change
- Email user when password is reset by admin
- How to set up User email verification after Signup?
- How can I get users email (and additional data) from the rest API?
- How to discover and delete unused accounts?
- Send activation email to user after signup [duplicate]
- Buddypress – Send New User Activation Link to Admin [closed]
- Adding second Email address for WP user notifications
- How can I check if a user’s email exists in the database
- Suddenly all emails in User have [email protected]
- Translate emails into the language of the user
- How to notify specific users when i’m posting/modifying a new post
- Unable to change email address of admin on localhost
- Send email to all registered users [closed]
- how to remove email field from default user registration form on wordpress
- What is correct way to change user’s email?
- Send clear password via mail
- Need to manually add multiple WP users with same e-mail address (with good reason)
- WP Create User – Preventing repeated information
- User with same Mail but a different additional info(like domain)
- How do I update user email from frontend input field?
- Custom Password Reset
- Send user auto generated password on different email
- User email verification without a plugin, is it possible?
- Exclude Current user email and send notification
- New User Registration email
- Email Subscribe for Downloads in WordPress
- Remove My Account Menu items in Woocommerce based on user roles
- How to change the default registration email ? (plugin and/or non-plugin)
- Make WooCommerce pages accessible for logged in users only
- How to limit users to one comment per post
- Is there an upper limit for users in WP?
- How to get the Gravityform entry ID from current user’s form submission? [closed]
- Post list based on the user that is logged in
- Extending WP_User class and using this sub-class during the whole lifecycle
- Why does is_user_logged_in() return false after redirect from another site?
- How can I add a user through SQL?
- How to use tinyMCE for user “biographical info” without messing with any core file?
- Get user info outside WordPress
- How to change the order in which users are displayed in admin?
- Total number of authors with more than one post
- WordPress has a trash for users? (Wrong result for count_user, greater than expected)
- How Do I Prevent Junk Account Creation?
- Hide a user from WordPress
- Redirect after users complete profile form
- Cannot set user passwords
- Memory usage for scalable usermeta queries
- Can’t add users in admin after copying database
- How can i create an array user meta?
- Exclude admin from user list
- How to display total number of post done by user, it should display at authors page wordpress [duplicate]
- When I try to login in wordpress it is showing “USER Doesn’t Exists”
- Displaying different in-page content to cliente/admin
- Can i add password field into my wp registration form?
- User capability for editing their own comments
- how to get WordPress admin user table columns name in my plugin
- Allow Contributors to Upload Files
- Create Next and Previous Link to User orderby Last Name
- OAuth 2 and saving the authenticated user
- Spam users registers even when registration is disabled
- Getting the age of a users account
- New user form rejected because “passwords don’t match”—but there’s only one password field
- How can I prevent certain custom roles from seeing other custom roles on the user list page?
- “the_author_meta(‘url’)” not working inside “href”
- REST API: wp_get_current_user not working on second call
- How do I filter users based on email address?
- How to get custom post_author?
- User roles not displaying
- Allow admins to login as other users
- How to count total words for posts published by one author?
- Should I setup frontend-only users as CPT or use a plug-in?
- How to expire user registration?
- Delete a user from frontend
- Echo a list of all subscriber’s user IDs
- wp_delete_user – huge overhead in Buddypress?
- Get current logged-in user from external site
- Delete all users with Editor role and their content mysql
- Get UserInfo from WordPress
- How to display a calendar with events depending on the user?
- How can i display pagination in custom comment list?
- hide page menu from admin panel for specific users
- Single Sign On (SSO) between two WordPress websites
- Disabling user capability to edit_posts or delete_posts in the front-end
- $user_login is not working if author has only 1 post
- How to use a transient inside WP_User_Query
- Allowing users to edit only their page and nobody else’s
- How to bulk change user role to “No role for this site”
- Showing extra profile fields in admin – problem with underscore
- Insert query not working for non-logged in user
- Add new user and user bio at same time
- How to create a link to a user’s profile page
- Let admin users edit member profiles from front end
- Storing additional information about the user
- Current User Seeing Another Logged In User Info
- What techniques can a user employ to achieve a password rated “strong” in the WordPress password checker
- Cant edit profile from frontend
- application password is missing