upskill-event-manager/wordpress-dev/wordpress/wp-content/plugins/hvac-community-events/includes/certificates
bengizmo 39eb20e72b fix: Implement parse_request fallback for certificate URLs
This commit provides a bulletproof solution for certificate download URLs that works even when WordPress rewrite rules fail.

## The Problem
Certificate URLs (/hvac-certificate/{token}/) were returning 404 errors because WordPress rewrite rules weren't being properly recognized, despite multiple attempts to flush them.

## The Solution
Implemented a parse_request hook that intercepts certificate URLs before WordPress handles routing. This approach:
- Works immediately without needing rewrite rule flushes
- Bypasses WordPress rewrite rule system entirely
- Catches certificate URLs early in the request lifecycle
- Provides same security and functionality as rewrite rules

## Technical Implementation
1. Added parse_request hook with priority 1 in Certificate Security class
2. Uses regex to detect /hvac-certificate/{token}/ pattern in REQUEST_URI
3. Validates token and serves certificate file directly
4. Exits after serving to prevent WordPress 404 handling

## Testing Results
 Direct certificate URL test shows handler is working
 Invalid tokens show 'Invalid or expired certificate download link'
 URLs are intercepted before WordPress 404 handling

## User Action Required
The certificate URL handling is now working. If certificates still don't download:
1. The download tokens may have expired (1 hour limit)
2. Certificate files may be missing from the server
3. New certificates need to be generated with working URLs

Users should:
- Generate new certificates to get fresh download tokens
- Check that certificate files exist in wp-content/uploads/hvac-certificates/
- Ensure .htaccess file exists in certificate directory for security

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-05-24 00:02:03 -03:00
..
class-certificate-ajax-handler.php feat: Add comprehensive UX enhancements for mobile and desktop 2025-05-23 16:41:01 -03:00
class-certificate-fix.php docs: Update testing procedures in CLAUDE.md with comprehensive E2E test workflow 2025-05-21 20:12:22 -03:00
class-certificate-generator.php feat: Add PNG generation and fix certificate reports TEC query interference 2025-05-23 07:29:09 -03:00
class-certificate-installer.php feat: Add PNG generation and fix certificate reports TEC query interference 2025-05-23 07:29:09 -03:00
class-certificate-manager-broken.php fix: Repair certificate generation and listing functionality 2025-05-23 10:19:38 -03:00
class-certificate-manager.php fix: Resolve PHP errors in Certificate Manager SQL query construction 2025-05-23 14:13:31 -03:00
class-certificate-security.php fix: Implement parse_request fallback for certificate URLs 2025-05-24 00:02:03 -03:00
class-certificate-settings.php feat: Implement certificate generation system 2025-05-20 15:17:55 -03:00
class-certificate-template.php feat: Implement certificate generation system 2025-05-20 15:17:55 -03:00
test-rewrite-rules.php fix: Enhanced certificate URL rewrite rules handling 2025-05-23 23:20:29 -03:00