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/hunter28-lucky/work_hr_new_plugin/archive/refs/heads/main.zipHR Nomination Form WordPress Plugin
A robust WordPress plugin designed to fix and activate broken HTML nomination forms (such as raw HTML blocks in WPBakery Page Builder or Elementor) without modifying theme files. It provides native form processing, email notifications with attached CSV files, database storage, admin management with CSV/Excel exports, and seamless GitHub auto-updates.
🚀 Key Features
- Zero WPBakery Edits Needed: JavaScript dynamically locates
.hr-formon page load, injectingaction="admin-post.php",name="action" value="hr_nomination_form", WordPress security nonces, return redirect URLs, and invisible honeypots. - Dual Request Handlers: Hooks
admin_post_hr_nomination_formandadmin_post_nopriv_hr_nomination_formto accept submissions from both logged-in and guest visitors. - Rigorous Field Sanitization & Validation:
- Fields validated:
company_name,website,contact_person,job_title,email,phone,category,company_overview, andconsent. - Sanitized using standard WordPress sanitizers (
sanitize_text_field,esc_url_raw,sanitize_email,sanitize_textarea_field). - Captures extra fields dynamically in JSON format so no submitted data is lost.
- Fields validated:
- Spam & Abuse Protection:
- Invisible honeypot field traps automated bots.
- Transient-based IP rate limiting (1 submission per IP per 60 seconds).
- HTML Email Notifications with CSV Attachment:
- Formatted HTML email table sent via
wp_mail(). - Customizable subject template with
{company_name},{category},{contact_person}, etc. - Direct submitter
Reply-To. - Automatically generates and attaches a
.csvfile containing the submission data.
- Formatted HTML email table sent via
- Persistent Database Storage:
- Stores submissions in a dedicated table
wp_hr_nominations. - Track email delivery status, submitter IP address, and submission timestamp.
- Stores submissions in a dedicated table
- Comprehensive Admin UI:
- Top-level menu: HR Nominations.
- Submissions table with search, category filtering, and pagination.
- Detailed modal preview for viewing full nomination details.
- Resend email notification action.
- Single and bulk deletion with security nonces.
- Export to CSV (with UTF-8 BOM for Excel).
- Export to Excel (.xlsx) generated in pure PHP via
ZipArchive(zero external Composer packages).
- Front-end Feedback & UX:
- Success and error banners automatically rendered based on
?nomination=successor?nomination=error. - Prevents double submissions: disables submit button and displays animated loading spinner.
- Auto-cleans query parameters from browser URL using
window.history.replaceState.
- Success and error banners automatically rendered based on
- GitHub Auto-Update:
- Self-contained updater class interacting with GitHub Releases API.
- Hooks into WordPress core update transient (
pre_set_site_transient_update_plugins) and plugin info modal (plugins_api). - 6-hour transient caching to respect GitHub API rate limits.
- Supports Personal Access Tokens (PAT) for private repositories.
- Automatically handles folder renaming so updates install cleanly into
hr-nomination-form/.
📁 Plugin File Structure
hr-nomination-form/
├── hr-nomination-form.php # Main plugin loader, constants & bootstrap
├── includes/
│ ├── class-database.php # Custom table schema, CRUD operations & filters
│ ├── class-form-handler.php # Nonces, validation, sanitization, email & CSV
│ ├── class-frontend.php # Frontend asset enqueueing & localization
│ ├── class-admin.php # Admin menu, submissions table, settings & exports
│ └── class-updater.php # Native GitHub Releases auto-updater
├── assets/
│ ├── js/
│ │ └── frontend.js # DOM injection, client validation & UX banners
│ └── css/
│ └── frontend.css # Styling for alerts, spinners & error states
├── readme.txt # Standard WordPress repository metadata
└── README.md # Documentation & GitHub release guide
🛠️ Installation & Setup
- Upload Plugin:
- Copy the
hr-nomination-form/folder into your site's/wp-content/plugins/directory, OR - In WP Admin, go to Plugins > Add New > Upload Plugin and upload
hr-nomination-form.zip.
- Copy the
- Activate:
- Activate HR Nomination Form from the Plugins screen.
- Configure Settings:
- Go to HR Nominations > Settings:
- Recipient Email(s): Enter recipient email(s) (comma-separated if multiple).
- Email Subject Template: e.g.,
New HR Nomination: {company_name} - {category}. - From Name & Email: Set sender details.
- CSV Attachment: Toggle attaching
.csvto notification emails. - Database Storage: Toggle logging submissions to
wp_hr_nominations. - GitHub Repository Slug: Enter
your-username/hr-nomination-formto enable updates. - Personal Access Token (PAT): Optional, for private repositories.
- Go to HR Nominations > Settings:
- Form Integration:
- Ensure your existing nomination form element or its container has the class
hr-form:<form class="hr-form"> <!-- your existing inputs --> </form> - The plugin automatically sets the form action, nonces, and submission handler.
- Ensure your existing nomination form element or its container has the class
📦 GitHub Release & Auto-Update Workflow
Follow these steps whenever releasing an update to GitHub:
Step 1: Bump Version Numbers
Update the version string in both files:
hr-nomination-form.php:* Version: 1.0.1 ... define( 'HR_NOMINATION_VERSION', '1.0.1' );readme.txt:Stable tag: 1.0.1
Step 2: Commit & Push Changes
git add .
git commit -m "Release version 1.0.1: [describe your changes]"
git push origin main
Step 3: Create GitHub Release
- In your GitHub repository, go to Releases > Draft a new release.
- Choose a tag: Type
v1.0.1(or1.0.1) and select "Create new tag on publish". - Release title:
HR Nomination Form 1.0.1. - Description: Detail changes, fixes, and improvements (this is shown in the WordPress update changelog).
Step 4: Attach Plugin Zip Asset
- Build the zip file:
zip -r hr-nomination-form.zip hr-nomination-form/ -x "*.git*" - Drag and drop
hr-nomination-form.zipinto the GitHub release asset dropzone. - Click Publish release.
Within 6 hours (or immediately upon checking for updates in WordPress), sites running the plugin will display "There is a new version of HR Nomination Form available" with full one-click update functionality!
🧪 Comprehensive Verification Checklist
Use this checklist to confirm all requirements are met:
- [x] Form Injection:
- Open page with
.hr-form. - Inspect DOM: verify
actionis set to.../wp-admin/admin-post.php,method="POST", hiddenaction="hr_nomination_form",hr_nomination_nonce, and hidden honeypot wrapper exist.
- Open page with
- [x] Submission Flow:
- Fill in all required fields and click submit.
- Verify submit button becomes disabled and displays loading spinner.
- Submitter is redirected back to the page with
?nomination=success. - Clean green success banner appears above the form and URL query params are smoothly cleared.
- [x] Email Notification:
- Admin inbox receives formatted HTML email with submission details.
- Submitter email is set in
Reply-To. .csvfile is attached containing the nomination data.
- [x] Database Row Created:
- Check WP Admin > HR Nominations > Submissions.
- Submission appears with correct Company Name, Contact Person, Category, and date.
- Click "View Details" to inspect the modal with full information.
- [x] Rate Limiting & Spam Protection:
- Attempting a second submission from the same IP within 60s triggers the rate limit error banner.
- Filling the invisible honeypot field prevents delivery without disruption.
- [x] Admin Actions & Exports:
- Click Export to CSV: downloads valid
.csvwith UTF-8 BOM. - Click Export to Excel (.xlsx): downloads native OpenXML
.xlsxspreadsheet that opens in Excel and Google Sheets without warnings. - Click "Resend" to verify email re-dispatch.
- Delete single entry and test bulk delete.
- Click Export to CSV: downloads valid
- [x] Automated Updates:
- Secure background release verification.
- Publish release tag higher than current header version.
- Go to Dashboard > Updates in WordPress; verify update notice and changelog appear.
👨💻 Author & Intellectual Property
Developed by Harshvardhan Kumar (Krish Goswami)
Enterprise Form Engine, Ingestion Pipeline & Proprietary Architecture