Mass Delete Users by Email

AI Plugin Information
Version 3
Download Download Plugin

# Mass Delete Users by Email

A WordPress plugin that allows administrators to permanently delete multiple user accounts at once by pasting a list of email addresses.

## Description

Mass Delete Users by Email is an administrative utility designed for WordPress site administrators who need to remove multiple user accounts efficiently. Common use cases include:

– Cleaning up spam registrations
– Removing test accounts
– Processing bulk account removal requests
– Managing user databases after migrations or imports

## Features

### Two-Step Workflow
1. **Preview**: Paste email addresses and preview which users will be deleted
2. **Execute**: Review the preview and confirm permanent deletion

### Comprehensive Deletion
When a user is deleted, the plugin permanently removes:
– User account and metadata
– Posts, pages, and custom post types
– Comments (including comment metadata)
– Media and attachments

### Safety Features
– **Preview before deletion**: See exactly which users will be deleted
– **Self-deletion prevention**: Cannot delete your own admin account
– **Batch integrity validation**: Revalidates users between preview and execution
– **CSRF protection**: WordPress nonces protect all form submissions
– **Capability checks**: Restricted to users with `manage_options` capability

### Flexible Input
– Supports comma-separated email addresses
– Supports newline-separated email addresses
– Supports mixed formats
– Handles Windows, Unix, and macOS line endings
– Automatically trims whitespace and removes duplicates
– Validates email format

### Detailed Results
After deletion, view comprehensive results showing:
– Successfully deleted users
– Skipped users (with reasons)
– Failed deletions (with error messages)
– Email addresses not found
– Invalid email addresses

## Requirements

– WordPress 6.5 or higher
– PHP 7.4 or higher
– Administrator account with `manage_options` capability

## Installation

1. Upload the plugin files to `/wp-content/plugins/aiplugin5032/`
2. Activate the plugin through the ‘Plugins’ menu in WordPress
3. Navigate to **Tools → Mass Delete** to use the plugin

## Usage

1. Go to **Tools → Mass Delete** in your WordPress admin
2. Paste email addresses in the textarea (one per line or comma-separated)
3. Click **Preview Users** to see which users will be deleted
4. Review the preview carefully – check:
– Users found (with their details)
– Email addresses not found
– Invalid email addresses
5. Click **Permanently Delete X Users** to execute the deletion
6. Review the results screen showing what was deleted

## Important Warnings

⚠️ **PERMANENT DELETION**: This plugin permanently deletes user accounts and all their content. This action **CANNOT BE UNDONE**.

⚠️ **BACKUP FIRST**: Always create a complete backup of your WordPress database before using this plugin.

⚠️ **MULTISITE NOT SUPPORTED**: This plugin does not support WordPress Multisite installations.

### Services

**EmailParser**: Parses and validates email addresses from textarea input
– Handles multiple formats (comma, newline, mixed)
– Normalizes line endings
– Validates email format
– Removes duplicates
– Separates valid and invalid entries

**UserLookup**: Looks up WordPress users by email address
– Resolves emails to user IDs
– Retrieves user details (username, display name, roles)
– Revalidates users between preview and execution

**UserDeletion**: Handles permanent user deletion
– Deletes user accounts via `wp_delete_user()`
– Explicitly deletes user-authored comments
– Processes batches individually (one failure doesn’t stop the batch)
– Prevents self-deletion
– Validates batch integrity

## Security

– **Capability checks**: All operations require `manage_options` capability
– **Nonce verification**: CSRF protection on all form submissions
– **Batch integrity**: Revalidates user/email relationships before deletion
– **Self-deletion prevention**: Current admin cannot delete their own account
– **Input validation**: Email format validation and sanitization

## Error Handling

The plugin gracefully handles:
– Empty textarea input
– Invalid email addresses
– Duplicate emails
– Users not found
– Users deleted between preview and execution
– WordPress deletion API failures
– Extremely long input
– Mixed formatting and blank lines

Errors for individual users do not abort the entire batch.

## Limitations

– **No undo**: Deletion is permanent
– **No logging**: Does not create permanent records of deleted users (privacy by design)
– **Multisite**: Not supported in this version
– **Synchronous processing**: Processes users sequentially (suitable for administrative batches)

## Development

### Namespace
All PHP classes use the `aiplugin5032` namespace.

### WordPress Hooks Used
– `admin_menu`: Registers the Tools submenu page
– `admin_enqueue_scripts`: Enqueues admin CSS
– `delete_user` / `deleted_user`: Fired during deletion (via `wp_delete_user()`)

### WordPress APIs Used
– `wp_delete_user()`: Core user deletion
– `wp_delete_comment()`: Comment deletion
– `get_user_by()`: User lookup
– `current_user_can()`: Capability checks
– `wp_verify_nonce()`: CSRF protection

## Support

This is proprietary software. For support, contact the plugin author.

## License

Copyright (C) AI_PLUGIN_DEV 2026. ALL RIGHTS RESERVED. THIS IS NOT FREE SOFTWARE.

## Changelog

### Version 2.0.0
– Initial implementation of Mass Delete Users by Email
– Two-step preview and deletion workflow
– Comprehensive user and content deletion
– Security features (nonce, capability checks, self-deletion prevention)
– Detailed results reporting
– Multisite detection and refusal