WP Manifestindependent plugin directory
manifest / security / log-wp-user-creation

Log WP User Creation

Log all WordPress user creation with origin tracking (IP, backtrace, source detection)

by Be API · github.com/beapi/log-wp-user-creation · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/beapi/log-wp-user-creation/archive/refs/heads/main.zip

Log all WordPress user creation with origin tracking (IP, backtrace, source detection) for security and debugging purposes.

Description

Log WP User Creation is a powerful WordPress plugin that tracks and logs all user creation events with detailed origin information. This plugin is essential for security monitoring, debugging, and understanding how users are being created in your WordPress installation.

Key Features

  • Complete User Creation Logging: Tracks every user creation event with comprehensive details
  • Origin Detection: Automatically detects the source of user creation (frontend, admin, AJAX, REST API, CLI, etc.)
  • IP Address Tracking: Records the IP address of the user creation request
  • Detailed Backtrace: Captures a complete backtrace to identify the exact code path that triggered user creation
  • Source Classification: Categorizes user creation by source type for easy filtering and analysis
  • Multisite Support: Full support for WordPress Multisite installations
  • Admin Interface: Clean, intuitive admin interface for viewing and managing logs
  • Advanced Filtering: Filter logs by date range, source, user, IP address, and more
  • Export Capabilities: Easy export of log data for further analysis
  • Automatic Cleanup: Configurable automatic cleanup of old log entries
  • Performance Optimized: Minimal impact on site performance with efficient database queries

Use Cases

  • Security Monitoring: Track suspicious user creation patterns
  • Debugging: Identify why and how users are being created
  • Compliance: Maintain audit trails for user creation events
  • Plugin Development: Debug user creation issues in custom plugins
  • Site Administration: Monitor user registration across multiple sites

Source Detection

The plugin automatically detects and categorizes user creation by source:

  • Frontend: User registration through public forms
  • Admin: User creation through WordPress admin interface
  • AJAX: User creation via AJAX requests
  • REST API: User creation through REST API endpoints
  • CLI: User creation via WP-CLI commands
  • Other Plugins: User creation triggered by other plugins

Backtrace Information

For each user creation event, the plugin captures:

  • Complete call stack leading to user creation
  • File names and line numbers
  • Function names and class methods
  • Plugin and theme involvement
  • WordPress core function calls

Multisite Support

  • Network-wide logging for multisite installations
  • Per-site log filtering and management
  • Network admin interface for centralized log viewing
  • Site-specific log clearing capabilities

Installation

  1. Upload the plugin files to the /wp-content/plugins/log-wp-user-creation directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress
  3. For multisite installations, network activate the plugin
  4. Navigate to Tools > Log WP User Creation to view logs
  5. For multisite, navigate to Network Admin > Settings > Log WP User Creation

Frequently Asked Questions

Does this plugin affect site performance?

The plugin is designed with performance in mind. It uses efficient database queries and minimal hooks to ensure minimal impact on your site's performance. The logging is asynchronous and doesn't block user creation processes.

Can I disable IP logging?

Yes, you can disable IP logging by setting the LWUC_LOG_IP constant to false in your wp-config.php file.

How long are logs kept?

By default, logs are kept for 30 days. You can modify this by using the lwuc_expiration_days filter.

Can I export log data?

Yes, the plugin provides export functionality through the admin interface. You can export logs in various formats for further analysis.

Does it work with custom user creation plugins?

Yes, the plugin hooks into WordPress's user creation process, so it will log user creation regardless of how it's triggered, including custom plugins and themes.

Is it compatible with multisite?

Yes, the plugin has full multisite support with network-wide logging and per-site management capabilities.

Screenshots

  1. Main log view with filtering options
  2. Detailed backtrace information
  3. Network admin interface for multisite
  4. Source detection and categorization
  5. Advanced filtering options

Changelog

1.0.0

  • Initial release
  • Complete user creation logging
  • Origin detection and source classification
  • IP address tracking
  • Detailed backtrace capture
  • Multisite support
  • Admin interface with filtering
  • Automatic cleanup functionality
  • Performance optimization

Upgrade Notice

1.0.0

Initial release of Log WP User Creation plugin.

Technical Details

Database Schema

The plugin creates a custom table wp_lwuc_log with the following structure:

  • id: Primary key
  • blog_id: Blog ID for multisite
  • user_id: Created user ID
  • user_login: User login name
  • user_email: User email address
  • user_roles: User roles (comma-separated)
  • created_by_user_id: ID of user who created the account
  • ip_address: IP address of the request
  • user_agent: User agent string
  • request_uri: Request URI
  • referer: HTTP referer
  • source: Source type (frontend, admin, ajax, rest, cli, etc.)
  • backtrace: JSON-encoded backtrace data
  • cookies: Cookie names (not values)
  • is_ajax: Boolean flag for AJAX requests
  • is_rest: Boolean flag for REST API requests
  • is_cli: Boolean flag for CLI requests
  • is_admin: Boolean flag for admin requests
  • is_frontend: Boolean flag for frontend requests
  • date_added: Timestamp of the log entry

Hooks and Filters

The plugin provides several hooks and filters for customization:

  • lwuc_should_log_user_creation: Filter to control whether to log a user creation
  • lwuc_pre_insert_data: Filter to modify data before database insertion
  • lwuc_expiration_days: Filter to modify log retention period

Security Considerations

  • IP addresses are logged for security purposes
  • Cookie names (not values) are logged for debugging
  • Backtrace information helps identify the source of user creation
  • All data is sanitized before database insertion
  • Admin interface requires appropriate capabilities

Support

For support, feature requests, or bug reports, please visit the plugin's GitHub repository or contact the development team.

Privacy Policy

This plugin logs user creation events for security and debugging purposes. The logged data includes:

  • User information (login, email, roles)
  • IP addresses
  • User agent strings
  • Request information
  • Backtrace data

This data is stored locally in your WordPress database and is not transmitted to external servers. You are responsible for ensuring compliance with applicable privacy laws and regulations.