Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/itsikram/user-access/archive/refs/heads/main.zipA WordPress plugin that integrates with Ultimate Member to restrict user registration and login using a CSV-based whitelist.
Description
This plugin validates user registration and login attempts against a whitelist stored in a custom database table. Users are only allowed to register or login if their first name, last name, and birth year match a record in the whitelist with allowed = "Y".
Features
- CSV-Based Whitelist: Upload CSV files to manage the whitelist
- Identity Validation: Validates users by first name, last name, and birth year
- Registration Restriction: Blocks registration if user is not whitelisted
- Login Restriction: Blocks login if user is not whitelisted
- Birth Year Field: Automatically adds a Birth Year field to Ultimate Member registration forms
- Admin Interface: Easy-to-use admin page for CSV uploads
- Data Normalization: Automatically normalizes data (trim spaces, case handling)
- Duplicate Prevention: Prevents duplicate records in the database
- Efficient Lookups: Indexed database table for fast queries
Requirements
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Ultimate Member plugin (must be installed and activated)
Installation
- Upload the
um-csv-identity-whitelistfolder to/wp-content/plugins/ - Activate the plugin through the 'Plugins' menu in WordPress
- Ensure Ultimate Member plugin is installed and activated
- Go to Users > CSV Whitelist to upload your CSV file
CSV Format
The CSV file must have the following structure:
fname,lname,birthyear,allowed
SARAH,BREDE,1984,Y
DAVID,BURNSON,1977,Y
JOHN,SMITH,1990,N
Column Requirements
- fname: First name (text, will be normalized to uppercase)
- lname: Last name (text, will be normalized to uppercase)
- birthyear: Birth year (4-digit number, e.g., 1985)
- allowed: Y or N (case-insensitive)
Notes
- Column names are case-insensitive
- First row must be the header row
- Empty rows are skipped
- Invalid rows are skipped and counted as errors
- Duplicate records (same fname, lname, birthyear) will update the
allowedfield
Usage
Uploading a CSV File
- Navigate to Users > CSV Whitelist in WordPress admin
- Click "Choose File" and select your CSV file
- Optionally check "Replace Existing" to replace all existing records
- Click "Upload CSV"
- Review the import statistics
User Registration
When a user attempts to register:
- They must fill in First Name, Last Name, and Birth Year
- The plugin validates their information against the whitelist
- If not whitelisted, registration is blocked with an error message
- If whitelisted, registration proceeds normally
User Login
When a user attempts to login:
- The plugin validates their stored information against the whitelist
- If not whitelisted, login is blocked with an error message
- If whitelisted, login proceeds normally
Database Structure
The plugin creates a custom table: wp_um_csv_whitelist
Table Structure:
id(bigint) - Primary keyfname(varchar) - First name (indexed)lname(varchar) - Last name (indexed)birthyear(varchar) - Birth year (indexed)allowed(varchar) - Y or N (indexed)created_at(datetime) - Record creation timestamp- Unique constraint on (fname, lname, birthyear)
Security
- Nonce verification for all admin actions
- Capability checks (requires
manage_options) - File type validation (CSV only)
- SQL injection prevention (prepared statements)
- Data sanitization and validation
Hooks
Filters
um_submit_form_errors_hook__registration- Validates registrationauthenticate- Validates loginum_custom_error_message_handler- Custom error messages
Actions
um_after_register_fields- Adds Birth Year field to registration formum_before_save_registration_details- Saves Birth Year fieldlogin_message- Shows login error messages
Error Messages
- Registration Denied: "Your registration/login has been denied. Your identity information does not match our whitelist. Please contact support if you believe this is an error."
- CSV Upload Errors: Various validation errors are shown for invalid CSV files
Troubleshooting
Plugin doesn't work
- Ensure Ultimate Member is installed and activated
- Check that the database table was created (check database)
- Verify CSV format matches requirements
- Check WordPress error logs
Users can't register/login
- Verify CSV file was uploaded successfully
- Check that user's information matches whitelist exactly (case-insensitive)
- Ensure
allowedfield is set to "Y" for the user - Check that Birth Year field is being filled during registration
CSV upload fails
- Verify CSV file format matches requirements
- Check file size (max 10MB)
- Ensure file is actually a CSV file
- Check WordPress error logs for detailed error messages
Support
For support, please contact the plugin developer or check the WordPress support forums.
Changelog
1.0.0
- Initial release
- CSV upload functionality
- Registration and login validation
- Birth Year field integration
- Admin interface
License
GPL v2 or later