Customer Management WordPress Plugin
A comprehensive customer management plugin for WordPress with CRUD operations, admin interface, and frontend display capabilities.
by Abhishek · github.com/789abhi/customer-management-wordpress-plugin · website
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/789abhi/customer-management-wordpress-plugin/archive/refs/heads/master.zipReadme
Customer Management WordPress Plugin
A comprehensive WordPress plugin for managing customer records with full CRUD operations, search functionality, bulk import capabilities, and WordPress user integration.
📋 Table of Contents
- Features
- Requirements
- Installation
- Configuration
- Usage
- Shortcode Documentation
- Customer Data Fields
- Import Functionality
- WordPress User Integration
- Admin Features
- Frontend Features
- File Structure
- Database Schema
- Development
- Troubleshooting
- License
✨ Features
Core Functionality
- ✅ Complete CRUD operations (Create, Read, Update, Delete)
- ✅ Advanced search and filtering
- ✅ Bulk customer import via SQL files
- ✅ Automatic WordPress user creation
- ✅ Real-time age calculation from date of birth
- ✅ Customizable column visibility
- ✅ Pagination with adjustable items per page (20, 50, 100, 200)
- ✅ Responsive design for mobile and desktop
- ✅ AJAX-powered operations for smooth UX
Admin Panel Features
- Customer list with sortable columns
- Quick view, edit, and delete actions
- Bulk delete operations
- Column visibility settings
- Advanced search functionality
- Import progress tracking with visual progress bar
- Per-page selector for customizable list views
Frontend Features
- Customer listing via shortcode
- Search functionality
- Pagination controls
- Responsive grid layout
- Per-page selector
- Status filtering
🔧 Requirements
- WordPress: 5.0 or higher
- PHP: 7.4 or higher
- MySQL: 5.6 or higher
- Browser: Modern browser with JavaScript enabled
📥 Installation
Method 1: Download from GitHub & Upload via WordPress (Recommended)
✅ No server or file-manager access required.
-
Open the GitHub repository:
https://github.com/789Abhi/Customer-Management-WordPress-Plugin -
Click the Code button and select Download ZIP.
-
Log in to the WordPress Admin Dashboard.
-
Navigate to Plugins → Add New.
-
Click Upload Plugin.
-
Choose the downloaded ZIP file.
-
Click Install Now.
-
After installation completes, click Activate Plugin.
Method 2: Manual Installation (Using Git – Optional)
- Clone the repository:
git clone https://github.com/789Abhi/Customer-Management-WordPress-Plugin.git
⚙️ Configuration
Initial Setup
-
Database Table Creation
- The plugin automatically creates the required database table upon activation
- Table name:
wp_cm_customers(prefix may vary based on your WordPress installation)
-
Access the Plugin
- After activation, a new menu item "Customers" will appear in the WordPress admin sidebar
- Click on it to access the customer management interface
-
Configure Column Visibility
- Go to Customers → All Customers
- Click the Column Settings button
- Select which columns you want to display
- Click Apply to save your preferences
Optional Configuration
Per-Page Settings
- Both admin and frontend pages include a per-page selector
- Choose from 20, 50, 100, or 200 items per page
- Selection persists across page navigation
📖 Usage
Adding a New Customer
- Navigate to Customers → Add New
- Fill in all required fields:
- Name
- Email (must be unique - checked against both customer database and WordPress users)
- Phone Number (numeric only)
- Date of Birth (YYYY-MM-DD format)
- Gender
- CR Number (alphanumeric, must be unique)
- Address
- City
- Country
- Status (Active/Inactive)
- Click Add Customer
- A WordPress user will be automatically created with:
- Role: Contributor
- Username: Sanitized email
- Password: Phone number
Viewing Customer Details
- Go to Customers → All Customers
- Click View under any customer name
- A modal will display all customer information including calculated age
Editing a Customer
- Go to Customers → All Customers
- Click Edit under the customer name
- Modify the required fields
- Click Update Customer
Deleting Customers
Single Delete:
- Click Delete under the customer name
- Confirm the deletion
Bulk Delete:
- Select multiple customers using checkboxes
- Choose "Delete" from the Bulk Actions dropdown
- Click Apply
Searching Customers
Admin Panel:
- Use the search box at the top of the customer list
- Search works across: Name, Email, Phone, CR Number, Address, City, Country
Frontend:
- Search box is available in the shortcode display
- Real-time AJAX search without page reload
Importing Customers
- Navigate to Customers → Import SQL
- Click Choose File and select your SQL file
- Click Import SQL File
- Watch the progress bar as the import proceeds:
- File upload
- SQL processing
- Customer record insertion
- WordPress user creation
- View the detailed import summary showing:
- Total customers imported
- SQL queries executed
- WordPress users created/skipped
- Any errors encountered
🎨 Shortcode Documentation
Basic Shortcode
[customer_list]
📊 Customer Data Fields
Required Fields
| Field | Type | Validation | Description |
|---|---|---|---|
| Name | Text | Required | Customer's full name |
| Required, Unique, Valid email format | Customer's email address | ||
| Phone | Numeric | Required, Numbers only | Customer's phone number |
| Date of Birth | Date | Required, YYYY-MM-DD format | Customer's birth date |
| Age | Integer | Auto-calculated | Calculated from date of birth (not stored in DB) |
| Gender | Enum | Required | male, female, or other |
| CR Number | Alphanumeric | Required, Unique | Customer registration number |
| Address | Text | Required | Street address |
| City | Text | Required | City name |
| Country | Text | Required | Country name |
| Status | Enum | Required | active or inactive |
Auto-Generated Fields
- Created At: Timestamp of record creation
- Updated At: Timestamp of last update
Calculated Fields
- Age: Automatically calculated from Date of Birth and current date
- Updates dynamically based on current month
- Not stored in database
- Displayed in admin panel and frontend
📤 Import Functionality
SQL File Format
The plugin accepts SQL files with INSERT statements. Example format:
INSERT INTO `wp_cm_customers` (`name`, `email`, `phone`, `date_of_birth`, `gender`, `cr_number`, `address`, `city`, `country`, `status`) VALUES
('John Smith', 'john@example.com', '1234567890', '1990-01-15', 'male', 'CR00001', '123 Main St', 'New York', 'USA', 'active'),
('Jane Doe', 'jane@example.com', '0987654321', '1992-05-20', 'female', 'CR00002', '456 Oak Ave', 'Los Angeles', 'USA', 'active');
Import Process
- File Upload: Upload SQL file via admin interface
- Validation: System validates SQL file format
- Execution: SQL queries are executed sequentially
- User Creation: WordPress users are created for each imported customer
- Progress Tracking: Real-time progress bar shows import status
- Summary Report: Detailed report of import results
Import Features
- ✅ Progress bar with percentage completion
- ✅ Stage-based status messages
- ✅ Automatic WordPress user creation for all imported customers
- ✅ Duplicate detection (skips existing users)
- ✅ Error handling and reporting
- ✅ No page refresh during import (AJAX-based)
👥 WordPress User Integration
User Creation Rules
When a customer is added (manually or via import):
-
Email Verification
- Check if email exists in customer database → Block if exists
- Check if email exists in WordPress users → Block if exists
- Email must be unique across both systems
-
User Account Creation
- Username: Email with @ replaced by underscore (e.g., john_example.com)
- Email: Customer's email
- Password: Customer's phone number
- Display Name: Customer's name
- Role: Contributor
-
Duplicate Prevention
- If username exists, append customer ID (e.g., john_example.com_123)
- Existing WordPress users with same email prevent customer creation
User Management
- Users can log in with their email (username) and phone number (password)
- Contributors can access WordPress dashboard with limited permissions
- User accounts are linked to customer records
- Deleting a customer does NOT delete the WordPress user (manual cleanup required)
🎛️ Admin Features
Dashboard Overview
- Menu Location: WordPress Admin Sidebar → Customers
- Submenu Items:
- All Customers
- Add New
- Import SQL
Customer List Features
-
Sortable Columns
- Name (ascending/descending)
- CR Number (ascending/descending)
- Created At (default sort)
-
Column Visibility
- Toggle columns on/off
- Saved preferences persist across sessions
- Available columns: Name, Email, Phone, Date of Birth, Age, Gender, CR Number, Address, City, Country, Status
-
Per-Page Options
- 20, 50, 100, or 200 items per page
- Selection maintained during pagination
- Preserved with search and filters
-
Bulk Actions
- Select multiple customers
- Delete selected customers
- Confirmation before bulk delete
-
Quick Actions
- View: Open customer details in modal
- Edit: Edit customer information in modal
- Delete: Remove customer with confirmation
🌐 Frontend Features
Customer List Display
- Grid layout with responsive design
- Customer cards showing key information
- Search functionality
- Pagination controls
- Status badges (active/inactive)
- Age display (if available)
Responsive Design
- Mobile-optimized layout
- Touch-friendly controls
- Adjusts to screen size
- Grid adapts from 1-3 columns based on viewport
AJAX Features
- Search without page reload
- Pagination without page reload
- Smooth loading transitions
- Loading indicators
📁 File Structure
customer-management-updated-4/
├── admin/
│ ├── class-cm-admin.php # Admin functionality
│ └── views/
│ ├── add-customer.php # Add customer form
│ ├── customers-list.php # Customer list table
│ ├── edit-customer.php # Edit customer form
│ ├── import-sql.php # SQL import interface
│ └── view-customer.php # Customer details view
├── assets/
│ ├── css/
│ │ ├── admin.css # Admin panel styles
│ │ └── frontend.css # Frontend styles
│ └── js/
│ └── admin.js # Admin JavaScript
├── database/
│ ├── import.php # Legacy import script
│ └── wp_cm_customers.sql # Sample SQL data
├── includes/
│ ├── class-cm-ajax.php # AJAX handlers
│ ├── class-cm-customer.php # Customer model
│ └── class-cm-database.php # Database operations
├── public/
│ └── class-cm-frontend.php # Frontend functionality
├── templates/
│ └── frontend/
│ ├── customer-item.php # Customer card template
│ ├── default.php # Default list template
│ └── pagination.php # Pagination template
├── customer-management.php # Main plugin file
└── README.md # This file
🗄️ Database Schema
Table: wp_cm_customers
CREATE TABLE `wp_cm_customers` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`email` varchar(100) NOT NULL,
`phone` varchar(20) NOT NULL,
`date_of_birth` date NOT NULL,
`gender` enum('male','female','other') NOT NULL,
`cr_number` varchar(50) NOT NULL,
`address` text NOT NULL,
`city` varchar(50) NOT NULL,
`country` varchar(50) NOT NULL,
`status` enum('active','inactive') DEFAULT 'active',
`created_at` datetime DEFAULT CURRENT_TIMESTAMP,
`updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `unique_email` (`email`),
UNIQUE KEY `unique_cr_number` (`cr_number`),
KEY `idx_status` (`status`),
KEY `idx_city` (`city`),
KEY `idx_country` (`country`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Indexes
- Primary Key:
id - Unique Indexes:
email,cr_number - Regular Indexes:
status,city,country
🛠️ Development
Extending the Plugin
Adding Custom Fields:
- Modify database schema in
includes/class-cm-database.php - Update customer model in
includes/class-cm-customer.php - Add field to forms in
admin/views/ - Update templates in
templates/frontend/
Customizing Templates:
- Copy template files to your theme:
wp-content/themes/your-theme/customer-management/ - Modify as needed
- Plugin will use theme templates if available
Hooks and Filters
// Add custom actions after customer creation
add_action('cm_after_customer_create', 'your_custom_function', 10, 2);
// Modify customer data before save
add_filter('cm_before_customer_save', 'your_filter_function', 10, 1);