upskill-event-manager/CLAUDE.md
bengizmo 587773b56b fix: Resolve CSS loading and Google Sheets redirect issues
Major fixes implemented:
1. CSS Loading on Hierarchical Pages - FIXED
   - Enhanced page detection logic in hvac-community-events.php
   - Added URL pattern matching for /trainer/* and /master-trainer/*
   - All 7 HVAC CSS files now load correctly on hierarchical pages

2. Google Sheets Infinite Redirect Loop - FIXED
   - Removed duplicate master-trainer-google-sheets page
   - Added redirect loop prevention with hvac_redirect_check parameter
   - Disabled WordPress canonical redirects for Google Sheets URLs
   - Page now loads in 2.4s with 0 redirects (was 50+ before)

3. Google Sheets Folder Manager Integration
   - Moved folder manager to proper location in includes/google-sheets/
   - Added conditional file loading to prevent fatal errors
   - Enhanced error handling throughout Google Sheets components

4. Dashboard Navigation Improvements
   - Fixed duplicate navigation buttons
   - Enhanced Master Trainer dashboard with folder hierarchy support
   - Improved permission checks and role-based access

Technical improvements:
- Added comprehensive debugging capabilities
- Enhanced error handling with try-catch blocks
- Improved conditional file loading patterns
- Fixed hardcoded URLs in Google Sheets admin

All issues tested and verified working on staging environment.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 06:50:53 -03:00

94 lines
No EOL
5.6 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
## 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.
[... rest of the existing content remains unchanged ...]