Leave a Reply

2 comments

  1. 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") . '>' . "rn";
         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');