WP Manifestindependent plugin directory
manifest / admin / wp-iranian-national-id-validator

WP Iranian National ID Validator

Adds a secure, lightweight WordPress dashboard widget for validating Iranian 10-digit National ID numbers using structural validation and checksum verification.

by Amirreza Shayesteh Far · github.com/amirrezashf/wp-iranian-national-id-validator · 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/amirrezashf/wp-iranian-national-id-validator/archive/refs/heads/main.zip

Readme

WP Iranian National ID Validator

A lightweight WordPress dashboard widget for validating Iranian National ID numbers using structural validation and checksum verification.

Description

WP Iranian National ID Validator adds a minimal and secure dashboard widget to the WordPress admin area. It allows permitted users to validate Iranian 10-digit National ID numbers directly from the WordPress dashboard.

The plugin checks the entered National ID structure, validates the 10-digit format, rejects fully repeated digits, verifies the checksum digit, and displays a clear validation result.

It is useful for WooCommerce stores, support teams, finance teams, customer verification workflows, order review processes, and admin-side operational checks where quick Iranian National ID validation is needed.

Features

  • Adds a lightweight dashboard widget to WordPress
  • Validates Iranian National ID numbers
  • Checks exact 10-digit structure
  • Verifies the checksum digit
  • Rejects fully repeated digit patterns
  • Supports Persian, Arabic, and English digit normalization
  • Displays clear valid or invalid status
  • Minimal admin-side UI
  • No external dependencies
  • No external API calls
  • No database storage
  • No National ID logging
  • Capability-based access control
  • Translation-ready strings
  • Filterable access capability
  • Single-file plugin architecture

Requirements

  • PHP 7.4 or higher
  • WordPress 6.0 or higher
  • WooCommerce capability support for the default access rule

By default, the dashboard widget is available to users with the manage_woocommerce capability.

Installation

  1. Download the plugin file.
  2. Create a folder named wp-iranian-national-id-validator.
  3. Place the plugin file inside the folder.
  4. Make sure the main plugin file is named:
wp-iranian-national-id-validator.php
  1. Upload the folder to:
wp-content/plugins/
  1. Activate the plugin from the WordPress admin panel.
  2. Go to the WordPress Dashboard.
  3. Use the “Iranian National ID Validator” widget.

Usage / How it Works

After activation, the plugin adds a dashboard widget to the WordPress admin area.

To validate a National ID:

  1. Open the WordPress Dashboard.
  2. Enter a 10-digit Iranian National ID.
  3. Click the check button.
  4. Review the validation result.

The widget displays:

  • Valid status
  • Invalid status
  • Validation message
  • Checksum-related error message when applicable
  • Format-related error message when applicable

The plugin performs all checks inside the browser after the dashboard page is loaded. It does not submit entered National ID numbers to the server.

Data Storage

This plugin does not store any data.

It does not create:

  • Custom database tables
  • WordPress options
  • Post meta
  • User meta
  • Transients
  • Logs
  • Analytics records

The entered National ID is processed only inside the dashboard widget interface and is not saved.

Development

The plugin is built as a lightweight single-file WordPress plugin and follows WordPress development best practices.

Development principles include:

  • WordPress Coding Standards
  • Native WordPress APIs
  • Secure capability validation
  • Escaped outputs
  • Translation-ready strings
  • Lightweight dashboard integration
  • No unnecessary database queries
  • No external requests
  • No third-party dependencies
  • Extensible codebase
  • Inline admin CSS registered through WordPress APIs
  • Inline admin JavaScript registered through WordPress APIs
  • Capability-based access control
  • Filterable configuration

The plugin uses:

  • Dashboard Widgets API
  • Admin enqueue APIs
  • Inline CSS
  • Inline JavaScript
  • WordPress filters
  • Browser-side National ID validation
  • Iranian National ID checksum validation

Hooks

wp_inidv_required_capability

Filters the required capability for displaying the dashboard widget.

Default value:

manage_woocommerce

Example:

add_filter(
    'wp_inidv_required_capability',
    static function () {
        return 'manage_options';
    }
);

Filters

wp_inidv_required_capability

Allows developers to change the required capability for accessing the dashboard widget.

Default capability:

manage_woocommerce

Example:

add_filter(
    'wp_inidv_required_capability',
    static function () {
        return 'manage_options';
    }
);

Future Improvements

  • Admin settings page
  • Custom capability selector
  • Optional server-side validation
  • REST API endpoint for validation
  • AJAX-based validation mode
  • Multisite support
  • Dashboard widget visibility settings
  • Role-based widget display rules
  • WooCommerce order screen integration
  • WooCommerce checkout helper integration
  • Customer profile integration
  • Optional validation history with privacy controls
  • Bulk National ID checker
  • CSV import
  • CSV export
  • Dashboard widget color customization
  • Admin notices for invalid entries
  • Block editor sidebar helper

License

GPL-2.0-or-later

This plugin is licensed under the GNU General Public License v2.0 or later.

Author

Amirreza Shayesteh Far

GitHub: https://github.com/amirrezashf


اعتبارسنجی کد ملی ایران برای وردپرس

یک ویجت سبک برای داشبورد وردپرس که کد ملی ایران را از نظر ساختار ۱۰ رقمی و رقم کنترلی بررسی می‌کند.

توضیحات

افزونه WP Iranian National ID Validator یک ویجت ساده، سبک و امن به داشبورد مدیریت وردپرس اضافه می‌کند. این ویجت به کاربران مجاز اجازه می‌دهد کد ملی ۱۰ رقمی ایران را مستقیماً از داشبورد وردپرس بررسی کنند.

این افزونه ساختار کد ملی، تعداد ارقام، الگوی ارقام تکراری و رقم کنترلی را بررسی می‌کند و نتیجه اعتبارسنجی را به‌صورت واضح نمایش می‌دهد.

این افزونه برای فروشگاه‌های ووکامرس، تیم‌های پشتیبانی، تیم‌های مالی، فرآیندهای احراز اطلاعات مشتری، بررسی سفارش‌ها و عملیات داخلی سایت‌های وردپرسی کاربرد دارد.

ویژگی‌ها

  • افزودن ویجت سبک به داشبورد وردپرس
  • اعتبارسنجی کد ملی ایران
  • بررسی ساختار دقیق ۱۰ رقمی
  • بررسی رقم کنترلی
  • رد کردن کدهای دارای ارقام کاملاً تکراری
  • پشتیبانی از تبدیل اعداد فارسی، عربی و انگلیسی
  • نمایش وضعیت معتبر یا نامعتبر
  • رابط کاربری مینیمال در پنل مدیریت
  • بدون وابستگی خارجی
  • بدون درخواست API خارجی
  • بدون ذخیره‌سازی اطلاعات
  • بدون ثبت لاگ کد ملی
  • کنترل دسترسی بر اساس capability
  • آماده برای ترجمه
  • قابلیت تغییر سطح دسترسی با filter
  • معماری تک‌فایلی

نیازمندی‌ها

  • PHP نسخه 7.4 یا بالاتر
  • WordPress نسخه 6.0 یا بالاتر
  • پشتیبانی از capability ووکامرس برای سطح دسترسی پیش‌فرض

به‌صورت پیش‌فرض، ویجت فقط برای کاربرانی نمایش داده می‌شود که capability زیر را داشته باشند:

manage_woocommerce

نصب

  1. فایل افزونه را دانلود کنید.
  2. یک پوشه با نام wp-iranian-national-id-validator بسازید.
  3. فایل افزونه را داخل این پوشه قرار دهید.
  4. مطمئن شوید نام فایل اصلی افزونه به این شکل باشد:
wp-iranian-national-id-validator.php
  1. پوشه افزونه را در مسیر زیر آپلود کنید:
wp-content/plugins/
  1. افزونه را از پنل مدیریت وردپرس فعال کنید.
  2. وارد داشبورد وردپرس شوید.
  3. از ویجت اعتبارسنجی کد ملی استفاده کنید.

نحوه استفاده / عملکرد افزونه

بعد از فعال‌سازی، افزونه یک ویجت به داشبورد مدیریت وردپرس اضافه می‌کند.

برای اعتبارسنجی کد ملی:

  1. وارد داشبورد وردپرس شوید.
  2. کد ملی ۱۰ رقمی ایران را وارد کنید.
  3. روی دکمه بررسی کلیک کنید.
  4. نتیجه اعتبارسنجی را مشاهده کنید.

ویجت موارد زیر را نمایش می‌دهد:

  • وضعیت معتبر
  • وضعیت نامعتبر
  • پیام اعتبارسنجی
  • پیام خطای مربوط به رقم کنترلی
  • پیام خطای مربوط به فرمت

بررسی‌ها بعد از بارگذاری صفحه داشبورد، داخل مرورگر انجام می‌شوند و کد ملی واردشده به سرور ارسال نمی‌شود.

ذخیره‌سازی داده

این افزونه هیچ داده‌ای ذخیره نمی‌کند.

افزونه موارد زیر را ایجاد نمی‌کند:

  • جدول اختصاصی دیتابیس
  • option در وردپرس
  • post meta
  • user meta
  • transient
  • log
  • رکوردهای analytics

کد ملی واردشده فقط داخل رابط ویجت داشبورد پردازش می‌شود و ذخیره نمی‌شود.

توسعه

این افزونه با معماری سبک و تک‌فایلی توسعه داده شده و از اصول استاندارد توسعه افزونه وردپرس پیروی می‌کند.

اصول توسعه شامل موارد زیر است:

  • WordPress Coding Standards
  • استفاده از Native WordPress APIs
  • اعتبارسنجی امن capability
  • خروجی‌های escape شده
  • متن‌های آماده ترجمه
  • اتصال سبک به داشبورد وردپرس
  • بدون query غیرضروری دیتابیس
  • بدون درخواست خارجی
  • بدون وابستگی شخص ثالث
  • ساختار قابل توسعه
  • ثبت CSS داخلی از طریق API وردپرس
  • ثبت JavaScript داخلی از طریق API وردپرس
  • کنترل دسترسی بر اساس capability
  • تنظیمات قابل تغییر با filter

این افزونه از موارد زیر استفاده می‌کند:

  • Dashboard Widgets API
  • Admin enqueue APIs
  • Inline CSS
  • Inline JavaScript
  • WordPress filters
  • اعتبارسنجی سمت مرورگر
  • اعتبارسنجی رقم کنترلی کد ملی ایران

هوک‌ها

wp_inidv_required_capability

این filter سطح دسترسی لازم برای نمایش ویجت داشبورد را تغییر می‌دهد.

مقدار پیش‌فرض:

manage_woocommerce

نمونه استفاده:

add_filter(
    'wp_inidv_required_capability',
    static function () {
        return 'manage_options';
    }
);

فیلترها

wp_inidv_required_capability

به توسعه‌دهندگان اجازه می‌دهد capability لازم برای مشاهده ویجت داشبورد را تغییر دهند.

capability پیش‌فرض:

manage_woocommerce

نمونه استفاده:

add_filter(
    'wp_inidv_required_capability',
    static function () {
        return 'manage_options';
    }
);

بهبودهای آینده

  • صفحه تنظیمات در پنل مدیریت
  • انتخاب capability سفارشی
  • اعتبارسنجی اختیاری سمت سرور
  • endpoint برای REST API
  • اعتبارسنجی با AJAX
  • پشتیبانی از Multisite
  • تنظیمات نمایش ویجت داشبورد
  • قوانین نمایش ویجت بر اساس نقش کاربری
  • اتصال به صفحه سفارش‌های WooCommerce
  • کمک‌ابزار در checkout ووکامرس
  • اتصال به پروفایل مشتری
  • تاریخچه اعتبارسنجی اختیاری با کنترل‌های حریم خصوصی
  • بررسی گروهی کد ملی
  • import از CSV
  • export به CSV
  • شخصی‌سازی رنگ ویجت داشبورد
  • admin notice برای ورودی‌های نامعتبر
  • ابزار کمکی در sidebar ویرایشگر بلوکی

مجوز

GPL-2.0-or-later

این افزونه تحت مجوز GNU General Public License v2.0 or later منتشر می‌شود.

نویسنده

Amirreza Shayesteh Far

GitHub: https://github.com/amirrezashf

Read the full README on GitHub →