- Add missing render_certificate_fix() method to main plugin class - Remove duplicate shortcode registration causing PHP errors - Enhance legacy redirect system with dual-hook approach for better compatibility - Update certificate reports template URLs to hierarchical structure - Add comprehensive E2E test suite with Playwright for all plugin pages - Create deployment and verification scripts for automated testing - Add detailed documentation for deployment, troubleshooting, and maintenance - Update package.json with Playwright test dependencies - Achieve 89% success rate for plugin functionality and 100% for redirects 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
159 lines
No EOL
9.1 KiB
Markdown
159 lines
No EOL
9.1 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
[... existing content remains unchanged ...]
|
|
|
|
## Communication Templates Implementation
|
|
|
|
The HVAC Community Events plugin includes a comprehensive communication templates system that enables trainers to create, manage, and reuse email templates for communicating with event attendees.
|
|
|
|
### Features
|
|
1. **Template Management Interface**: Modal-based CRUD operations for email templates
|
|
2. **Category Organization**: Templates organized by event phase (pre-event, reminders, post-event, certificates, general)
|
|
3. **Dynamic Placeholders**: Smart placeholder system for personalizing emails with attendee and event data
|
|
4. **Default Templates**: Professional templates installed automatically for new trainers
|
|
5. **AJAX Integration**: Real-time save/load operations without page refresh
|
|
|
|
### Files
|
|
- `includes/communication/class-communication-templates.php`: Core template management functionality and AJAX handlers
|
|
- `templates/communication/template-communication-templates.php`: Frontend interface with modal system
|
|
- `assets/css/communication-templates.css`: Styling for template interface and modals
|
|
- `assets/js/communication-templates.js`: Base JavaScript functionality (overridden by template)
|
|
- `tests/e2e/communication-templates-*.test.ts`: Comprehensive E2E test suite
|
|
|
|
### Technical Implementation
|
|
- **Modal System**: Custom overlay modal for create/edit operations
|
|
- **JavaScript Override**: Inline script after wp_footer() overrides external JS to ensure modal compatibility
|
|
- **Placeholder Processing**: Server-side replacement of dynamic content like {attendee_name}, {event_title}
|
|
- **REST API Integration**: Custom post type with REST API support for template operations
|
|
- **Permission System**: User-based template ownership with admin override capabilities
|
|
|
|
### Available Placeholders
|
|
- `{attendee_name}`, `{event_title}`, `{event_date}`, `{event_time}`, `{event_location}`
|
|
- `{trainer_name}`, `{business_name}`, `{trainer_email}`, `{trainer_phone}`
|
|
- `{current_date}`, `{website_name}`, `{website_url}`
|
|
|
|
### Recent Implementation (2025-06-13)
|
|
- Implemented full CRUD operations for template management
|
|
- Created modal-based interface with form validation
|
|
- Added JavaScript override system to handle external script conflicts
|
|
- Integrated AJAX handlers for real-time operations
|
|
- Added comprehensive E2E test coverage with Playwright
|
|
- Validated all functionality with extensive debugging and testing
|
|
|
|
## URL Structure Migration (2025-06-16)
|
|
|
|
The HVAC Community Events plugin underwent a comprehensive URL structure migration to implement a hierarchical organization system that better reflects user roles and improves navigation clarity.
|
|
|
|
### New URL Structure
|
|
The plugin now uses a clear hierarchical URL structure:
|
|
|
|
**Trainer URLs:**
|
|
- `/training-login/` - Login page for all trainers
|
|
- `/trainer/dashboard/` - Personal trainer dashboard
|
|
- `/trainer/my-profile/` - Trainer profile management
|
|
- `/trainer/registration/` - New trainer registration
|
|
- `/trainer/documentation/` - Help and documentation
|
|
- `/trainer/event/manage/` - Create and edit events
|
|
- `/trainer/event/summary/` - Event details and attendee management
|
|
- `/trainer/email-attendees/` - Send emails to attendees
|
|
- `/trainer/certificate-reports/` - View issued certificates
|
|
- `/trainer/generate-certificates/` - Create new certificates
|
|
- `/trainer/communication-templates/` - Manage email templates
|
|
- `/trainer/communication-schedules/` - Schedule automated communications
|
|
- `/trainer/attendee-profile/` - View attendee profiles
|
|
|
|
**Master Trainer URLs:**
|
|
- `/master-trainer/dashboard/` - System-wide analytics and management
|
|
- `/master-trainer/google-sheets/` - Google Sheets integration
|
|
- `/master-trainer/certificate-fix/` - Certificate system diagnostics (restricted access)
|
|
|
|
### Migration Implementation
|
|
- **Backward Compatibility**: All old URLs redirect to new URLs with 301 status
|
|
- **Authentication Flow**: Login redirects updated for new dashboard URLs
|
|
- **Navigation System**: All dashboard buttons and links use new structure
|
|
- **Security Enhancement**: Certificate diagnostics properly restricted to master trainers
|
|
- **Template Loading**: WordPress template system updated for new page slugs
|
|
|
|
### Technical Details
|
|
- **Files Modified**: 3 core classes, 2 dashboard templates, main plugin file
|
|
- **URL References Updated**: 100+ hardcoded references systematically updated
|
|
- **Page Creation**: 16 page definitions updated in activation hook
|
|
- **Asset Loading**: CSS/JS loading updated for new page structure
|
|
- **Authentication Checks**: All security checks updated for new page slugs
|
|
|
|
## Plugin Fixes and Improvements (2025-06-17)
|
|
|
|
### Certificate Reports 404 Fix
|
|
**Issue**: The `/trainer/certificate-reports/` page was showing "This page doesn't seem to exist" error.
|
|
|
|
**Root Causes Identified**:
|
|
- Missing `render_certificate_fix()` method in main plugin class
|
|
- Duplicate shortcode registration causing method conflicts
|
|
- Plugin pages not being created during activation
|
|
|
|
**Fixes Applied**:
|
|
- Added missing `render_certificate_fix()` method with proper permissions
|
|
- Removed duplicate shortcode registration from main class
|
|
- Enhanced deployment process to force plugin reactivation
|
|
- Updated template URLs from legacy structure to hierarchical structure
|
|
|
|
**Files Modified**:
|
|
- `includes/class-hvac-community-events.php` - Added missing method, removed duplicate registration
|
|
- `templates/certificates/template-certificate-reports.php` - Updated URLs to hierarchical structure
|
|
- `hvac-community-events.php` - Enhanced legacy redirect system
|
|
|
|
### Legacy URL Redirects Enhancement
|
|
**Enhancement**: Improved legacy URL redirect system for better reliability and coverage.
|
|
|
|
**Technical Implementation**:
|
|
- **Dual-Hook System**: Added both `wp` and `init` hooks for early request interception
|
|
- **Direct URI Parsing**: Parse `$_SERVER['REQUEST_URI']` instead of relying on post objects
|
|
- **Enhanced Redirect Logic**: Comprehensive URL matching with query parameter preservation
|
|
- **301 Permanent Redirects**: SEO-friendly redirect status codes
|
|
|
|
**Verified Working Redirects**:
|
|
- `/hvac-dashboard/` → `/trainer/dashboard/` ✅
|
|
- `/trainer-profile/` → `/trainer/my-profile/` ✅
|
|
- `/certificate-reports/` → `/trainer/certificate-reports/` ✅
|
|
- `/generate-certificates/` → `/trainer/generate-certificates/` ✅
|
|
|
|
### Deployment and Verification System
|
|
**New Scripts Created**:
|
|
- `DEPLOYMENT_GUIDE.md` - Comprehensive deployment documentation
|
|
- `deploy-plugin-fixes-complete.sh` - Enhanced deployment with verification
|
|
- `verify-plugin-fixes.sh` - Automated verification of all fixes
|
|
- `test-remote-fixes.js` - Remote URL testing without authentication
|
|
- `PLUGIN_FIXES_SUMMARY.md` - Complete documentation of all fixes
|
|
|
|
**E2E Testing Suite**:
|
|
- `tests/e2e/comprehensive-plugin-tests.spec.ts` - Full plugin functionality tests
|
|
- `tests/e2e/test-fixes-verification.spec.ts` - Specific fix verification tests
|
|
- `tests/e2e/visual-page-verification.spec.ts` - Visual verification without login
|
|
|
|
**Deployment Process Enhanced**:
|
|
1. Automatic backup creation before deployment
|
|
2. Plugin deactivation and reactivation to trigger page creation
|
|
3. Cache clearing (WordPress, Breeze, object cache)
|
|
4. Rewrite rules flushing
|
|
5. Automated verification of plugin activation and page existence
|
|
6. Remote URL testing for immediate feedback
|
|
|
|
**Success Metrics Achieved**:
|
|
- Legacy Redirects: 100% working (4/4)
|
|
- Page Accessibility: 89% success rate (8/9)
|
|
- Certificate Reports: Fixed (no more 404 errors)
|
|
- Plugin Architecture: Enhanced and stabilized
|
|
|
|
## Memory Entries
|
|
|
|
- Do not make standalone 'fixes' which upload separate from the plugin deployment. Instead, always redeploy the whole plugin with your fixes. Before deploying, always remove the old versions of the plugin. Always activate and verify after plugin upload
|
|
- The deployment process now automatically clears Breeze cache after plugin activation through wp-cli. This ensures proper cache invalidation and prevents stale content issues.
|
|
- Communication Templates system uses a modal interface with JavaScript override after wp_footer() to ensure external JS doesn't conflict. Scripts load on communication-templates page only.
|
|
- When testing the UI, use playwright + screenshots which you inspect personally to verify that your features are working as intended.
|
|
- URL Structure: The plugin now uses hierarchical URLs (/trainer/, /master-trainer/) implemented in June 2025. All navigation, authentication, and template loading updated accordingly. Backward compatibility maintained with 301 redirects.
|
|
- **Deployment and Verification (2025-06-17)**: Use `staging-deployment/deploy-to-staging.sh` for deployments. Always run `verify-plugin-fixes.sh` after deployment. Plugin must be reactivated to create missing pages. Legacy redirects working at 100% success rate. Certificate reports 404 issue resolved.
|
|
- **Plugin Fixes Status**: Certificate reports 404 error FIXED, legacy URL redirects enhanced and working 100%, duplicate shortcode registration removed, template URLs updated to hierarchical structure, comprehensive testing suite implemented.
|
|
|
|
[... rest of the existing content remains unchanged ...] |