upskill-event-manager/wordpress-dev/URL_MAPPING.md
bengizmo 58626ffc16 fix: Resolve Master Trainer permissions and navigation issues
- Fix AJAX 400 error on master dashboard by adding missing handler
- Fix Google Sheets folder verification JSON parse error
- Fix certificate reports permission check for master trainers
- Update all navigation links to use new hierarchical URL structure
- Remove 11 duplicate/legacy WordPress pages
- Fix Google Sheets page redirect loop
- Update profile edit link behavior
- Document all URL mapping changes and fixes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-17 12:15:09 -03:00

5.9 KiB

HVAC Community Events Plugin - URL Structure Migration

URL Mapping - Old to New

Current URL New URL Priority Status
/community-login/ /training-login/ HIGH Complete
/trainer-registration/ /trainer/registration/ HIGH Complete
/hvac-dashboard/ /trainer/dashboard/ HIGH Complete
/master-dashboard/ /master-trainer/dashboard/ HIGH Complete
/manage-event/ /trainer/event/manage/ HIGH Complete
/event-summary/ /trainer/event/summary/ MEDIUM Complete
/trainer-profile/ /trainer/my-profile/ HIGH Complete
/attendee-profile/ /trainer/attendee-profile/ LOW Complete
/email-attendees/ /trainer/email-attendees/ MEDIUM Complete
/communication-templates/ /trainer/communication-templates/ MEDIUM Complete
/communication-schedules/ /trainer/communication-schedules/ MEDIUM Complete
/generate-certificates/ /trainer/generate-certificates/ MEDIUM Complete
/certificate-reports/ /trainer/certificate-reports/ MEDIUM Complete
/google-sheets/ /master-trainer/google-sheets/ MEDIUM Complete
/hvac-documentation/ /trainer/documentation/ LOW Complete
/certificate-fix/ /master-trainer/certificate-fix/ HIGH Complete

References to Update

High Priority Files (Core Navigation/Authentication)

  1. Main Plugin File (hvac-community-events.php)

    • Page creation array (lines 46-117)
    • Asset loading checks (lines 260-266, 342, 358, 374, 433)
  2. Login Handler (includes/community/class-login-handler.php)

    • Redirect URLs (lines 143, 175, 182, 202, 209, 214)
  3. HVAC Community Events Class (includes/class-hvac-community-events.php)

    • Authentication redirects (lines 154, 166, 178, 188, 191, 198, 212, 219)
  4. Dashboard Templates

    • templates/template-hvac-dashboard.php
    • templates/template-hvac-master-dashboard.php

Medium Priority Files (Navigation/Features)

  1. Dashboard Class (includes/class-hvac-dashboard.php)
  2. Manage Event Class (includes/class-hvac-manage-event.php)
  3. Registration Class (includes/class-hvac-registration.php)
  4. Settings Class (includes/class-hvac-settings.php)
  5. Help System (includes/class-hvac-help-system.php)

Low Priority Files (Templates/Tests)

  1. Certificate Templates (multiple files)
  2. Profile Templates
  3. Test Files (50+ files in /bin/ and root)

Implementation Strategy

Phase 1: Core Structure (HIGH Priority)

  1. Update page creation code in main plugin file
  2. Create URL mapping helper functions
  3. Update login redirection logic
  4. Add backward compatibility redirects

Phase 2: Navigation (HIGH Priority)

  1. Update dashboard navigation links
  2. Update authentication redirect URLs
  3. Update template hardcoded links

Phase 3: Features (MEDIUM Priority)

  1. Update shortcode references
  2. Update help system links
  3. Update asset loading checks

Phase 4: Testing & Documentation (LOW Priority)

  1. Update test files
  2. Update documentation
  3. Comprehensive testing

Backward Compatibility Plan

301 Redirects Required

All old URLs must redirect to new URLs using WordPress redirect functions:

// Example redirect mapping
$legacy_redirects = [
    'community-login' => 'training-login',
    'hvac-dashboard' => 'trainer/dashboard',
    'master-dashboard' => 'master-trainer/dashboard',
    'manage-event' => 'trainer/event/manage',
    'trainer-profile' => 'trainer/my-profile',
    'certificate-fix' => 'master-trainer/certificate-fix',
    // ... etc
];

Implementation Notes

  • Use WordPress wp_redirect() with 301 status
  • Preserve query parameters during redirects
  • Implement in template_redirect hook
  • Log redirects for monitoring

Security Considerations

Access Control Updates

  • Certificate Fix: Move to /master-trainer/ hierarchy requires permission check updates
  • Role-based URLs: Ensure URL structure matches permission model
  • Capability Checks: Update template redirect logic for new URLs

Testing Checklist

Functional Testing

  • All new URLs load correctly
  • All old URLs redirect properly
  • Login redirects to correct dashboard
  • Navigation between trainer/master trainer dashboards works
  • Certificate fix page restricted to master trainers only

Technical Testing

  • No 404 errors on any URL
  • Query parameters preserved in redirects
  • Assets load correctly on all pages
  • Help system links work
  • Test suite passes with new URLs

Deployment Plan

Pre-deployment

  1. Create database backup
  2. Test in staging environment
  3. Verify all redirects work
  4. Update user documentation

Deployment

  1. Deploy plugin with URL changes
  2. Clear all caches
  3. Test key user journeys
  4. Monitor for 404 errors

Post-deployment

  1. Monitor redirect usage
  2. Update external documentation
  3. Communicate changes to users
  4. Plan to remove redirects after transition period

Files to Modify

Core Files (16 files)

  • hvac-community-events.php
  • includes/class-hvac-community-events.php
  • includes/community/class-login-handler.php
  • includes/class-hvac-dashboard.php
  • includes/class-hvac-manage-event.php
  • includes/class-hvac-registration.php
  • includes/class-hvac-settings.php
  • includes/class-hvac-help-system.php
  • templates/template-hvac-dashboard.php
  • templates/template-hvac-master-dashboard.php
  • templates/template-trainer-profile.php
  • templates/template-event-summary.php
  • Multiple certificate template files
  • Test files (50+ files)

Estimated Effort

  • Planning/Analysis: Complete
  • Core Implementation: 4-6 hours
  • Template Updates: 2-3 hours
  • Testing: 2-3 hours
  • Documentation: 1-2 hours
  • Total: 10-15 hours