WP Manifestindependent plugin directory
manifest / users / customer-management-wordpress-plugin

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

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/789abhi/customer-management-wordpress-plugin/archive/refs/heads/master.zip

Readme

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

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.

  1. Open the GitHub repository:
    https://github.com/789Abhi/Customer-Management-WordPress-Plugin

  2. Click the Code button and select Download ZIP.

  3. Log in to the WordPress Admin Dashboard.

  4. Navigate to Plugins → Add New.

  5. Click Upload Plugin.

  6. Choose the downloaded ZIP file.

  7. Click Install Now.

  8. After installation completes, click Activate Plugin.


Method 2: Manual Installation (Using Git – Optional)

  1. Clone the repository:
    
    git clone https://github.com/789Abhi/Customer-Management-WordPress-Plugin.git

⚙️ Configuration

Initial Setup

  1. 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)
  2. 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
  3. 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

  1. Navigate to Customers → Add New
  2. 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)
  3. Click Add Customer
  4. A WordPress user will be automatically created with:
    • Role: Contributor
    • Username: Sanitized email
    • Password: Phone number

Viewing Customer Details

  1. Go to Customers → All Customers
  2. Click View under any customer name
  3. A modal will display all customer information including calculated age

Editing a Customer

  1. Go to Customers → All Customers
  2. Click Edit under the customer name
  3. Modify the required fields
  4. Click Update Customer

Deleting Customers

Single Delete:

  1. Click Delete under the customer name
  2. Confirm the deletion

Bulk Delete:

  1. Select multiple customers using checkboxes
  2. Choose "Delete" from the Bulk Actions dropdown
  3. 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

  1. Navigate to Customers → Import SQL
  2. Click Choose File and select your SQL file
  3. Click Import SQL File
  4. Watch the progress bar as the import proceeds:
    • File upload
    • SQL processing
    • Customer record insertion
    • WordPress user creation
  5. 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
Email Email 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

  1. File Upload: Upload SQL file via admin interface
  2. Validation: System validates SQL file format
  3. Execution: SQL queries are executed sequentially
  4. User Creation: WordPress users are created for each imported customer
  5. Progress Tracking: Real-time progress bar shows import status
  6. 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):

  1. 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
  2. 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
  3. 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

  1. Sortable Columns

    • Name (ascending/descending)
    • CR Number (ascending/descending)
    • Created At (default sort)
  2. 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
  3. Per-Page Options

    • 20, 50, 100, or 200 items per page
    • Selection maintained during pagination
    • Preserved with search and filters
  4. Bulk Actions

    • Select multiple customers
    • Delete selected customers
    • Confirmation before bulk delete
  5. 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:

  1. Modify database schema in includes/class-cm-database.php
  2. Update customer model in includes/class-cm-customer.php
  3. Add field to forms in admin/views/
  4. Update templates in templates/frontend/

Customizing Templates:

  1. Copy template files to your theme: wp-content/themes/your-theme/customer-management/
  2. Modify as needed
  3. 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);

🔍 Troubleshooting

Read the full README on GitHub →