upskill-event-manager/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes
bengizmo af1e94061c fix: Enhanced certificate URL rewrite rules handling
This commit provides a comprehensive fix for the certificate download 404 errors:

## Problem
Certificate URLs (/hvac-certificate/{token}/) were returning 404 errors even after deployment because WordPress rewrite rules weren't properly registered or flushed.

## Solutions Implemented

### 1. Enhanced Plugin Activation
- Certificate security class is now initialized BEFORE flushing rewrite rules during activation
- This ensures the custom rewrite rule 'hvac-certificate/([^/]+)/?$' is registered
- Activation now properly adds the rule and flushes to make it active

### 2. Added Certificate Fix Admin Page
- New diagnostics page at /certificate-fix/ (admin only)
- Shows certificate system status including:
  - Database table status and counts
  - Certificate file directory status
  - Recent certificate activity
- Includes 'Flush Rewrite Rules' button for manual fixing
- Provides direct test link for rewrite rule verification

### 3. Rewrite Rules Test Tool
- Added test script accessible at /wp-admin/admin.php?test_certificate_rewrite=1
- Shows whether certificate rewrite rules are registered
- Verifies query vars are properly set
- Can manually add and flush rules if missing

### 4. Manual Flush Capability
- Admins can trigger flush via /wp-admin/?hvac_flush_rewrite=1
- Useful for debugging without accessing Certificate Fix page

## User Instructions
If certificate URLs still return 404:
1. Go to /certificate-fix/ page
2. Click 'Flush Rewrite Rules' button
3. Test certificate viewing again

The certificate download system uses secure token-based URLs that expire after 1 hour for security. These URLs must be properly registered with WordPress rewrite rules to function.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-23 23:20:29 -03:00
..
admin feat: Enhanced test data creation and login system improvements 2025-05-22 15:54:15 -03:00
certificates fix: Enhanced certificate URL rewrite rules handling 2025-05-23 23:20:29 -03:00
community Fix dashboard data inconsistency and enhance test suite with WP API 2025-05-22 19:24:18 -03:00
zoho feat: Add Zoho CRM diagnostic and setup tools 2025-05-21 11:22:25 -03:00
class-event-author-fixer.php feat: Add Zoho CRM integration with staging mode protection 2025-05-19 13:17:44 -03:00
class-event-form-handler.php feat: Add Zoho CRM integration with staging mode protection 2025-05-19 13:17:44 -03:00
class-hvac-community-events.php fix: Enhanced certificate URL rewrite rules handling 2025-05-23 23:20:29 -03:00
class-hvac-dashboard-data-fixed.php feat: Add Zoho CRM integration with staging mode protection 2025-05-19 13:17:44 -03:00
class-hvac-dashboard-data-refactored.php feat: Add Zoho CRM integration with staging mode protection 2025-05-19 13:17:44 -03:00
class-hvac-dashboard-data.php fix: Resolve dashboard data display and certificate generation issues 2025-05-23 00:39:42 -03:00
class-hvac-dashboard-data.php.backup fix: Complete Generate Certificates page functionality and attendee display 2025-05-23 07:04:15 -03:00
class-hvac-dashboard.php fix: Resolve 5 critical bugs in certificate management and navigation system 2025-05-23 18:53:03 -03:00
class-hvac-form-builder.php feat: Add Zoho CRM integration with staging mode protection 2025-05-19 13:17:44 -03:00
class-hvac-help-system.php feat: Add comprehensive help system with welcome guide, tooltips, and documentation 2025-05-22 08:47:43 -03:00
class-hvac-logger.php feat: Add Zoho CRM integration with staging mode protection 2025-05-19 13:17:44 -03:00
class-hvac-registration.php feat: Add trainer profile editing functionality 2025-05-20 09:47:22 -03:00
class-hvac-roles.php fix: Resolve redirect loop when WordPress admin accesses HVAC dashboard 2025-05-22 15:59:33 -03:00
class-hvac-security.php feat: Add Zoho CRM integration with staging mode protection 2025-05-19 13:17:44 -03:00
class-hvac-settings-refactored.php feat: Add Zoho CRM integration with staging mode protection 2025-05-19 13:17:44 -03:00
class-hvac-settings.php feat: Add Trainer Login link to admin sidebar menu 2025-05-19 17:40:23 -03:00