## Major Enhancements ### 🏗️ Architecture & Infrastructure - Implement comprehensive Docker testing infrastructure with hermetic environment - Add Forgejo Actions CI/CD pipeline for automated deployments - Create Page Object Model (POM) testing architecture reducing test duplication by 90% - Establish security-first development patterns with input validation and output escaping ### 🧪 Testing Framework Modernization - Migrate 146+ tests from 80 duplicate files to centralized architecture - Add comprehensive E2E test suites for all user roles and workflows - Implement WordPress error detection with automatic site health monitoring - Create robust browser lifecycle management with proper cleanup ### 📚 Documentation & Guides - Add comprehensive development best practices guide - Create detailed administrator setup documentation - Establish user guides for trainers and master trainers - Document security incident reports and migration guides ### 🔧 Core Plugin Features - Enhance trainer profile management with certification system - Improve find trainer functionality with advanced filtering - Strengthen master trainer area with content management - Add comprehensive venue and organizer management ### 🛡️ Security & Reliability - Implement security-first patterns throughout codebase - Add comprehensive input validation and output escaping - Create secure credential management system - Establish proper WordPress role-based access control ### 🎯 WordPress Integration - Strengthen singleton pattern implementation across all classes - Enhance template hierarchy with proper WordPress integration - Improve page manager with hierarchical URL structure - Add comprehensive shortcode and menu system ### 🔍 Developer Experience - Add extensive debugging and troubleshooting tools - Create comprehensive test data seeding scripts - Implement proper error handling and logging - Establish consistent code patterns and standards ### 📊 Performance & Optimization - Optimize database queries and caching strategies - Improve asset loading and script management - Enhance template rendering performance - Streamline user experience across all interfaces 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			145 lines
		
	
	
		
			No EOL
		
	
	
		
			5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			145 lines
		
	
	
		
			No EOL
		
	
	
		
			5 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| /**
 | |
|  * Debug script for find-a-trainer page issues
 | |
|  */
 | |
| 
 | |
| // Bootstrap WordPress
 | |
| require_once('/var/www/html/wp-config.php');
 | |
| 
 | |
| echo "🔍 DEBUGGING FIND-A-TRAINER PAGE\n";
 | |
| echo "================================\n\n";
 | |
| 
 | |
| // 1. Check if trainer_profile post type is registered
 | |
| echo "1. Checking trainer_profile post type registration...\n";
 | |
| $post_types = get_post_types(['public' => false], 'names');
 | |
| if (in_array('trainer_profile', $post_types)) {
 | |
|     echo "✅ trainer_profile post type is registered\n";
 | |
| } else {
 | |
|     echo "❌ trainer_profile post type is NOT registered\n";
 | |
|     echo "Available post types: " . implode(', ', $post_types) . "\n";
 | |
| }
 | |
| 
 | |
| // 2. Check for trainer_profile posts
 | |
| echo "\n2. Checking for trainer_profile posts...\n";
 | |
| $profiles_query = new WP_Query([
 | |
|     'post_type' => 'trainer_profile',
 | |
|     'post_status' => 'publish',
 | |
|     'posts_per_page' => -1
 | |
| ]);
 | |
| 
 | |
| echo "Found {$profiles_query->found_posts} trainer_profile posts\n";
 | |
| 
 | |
| if ($profiles_query->have_posts()) {
 | |
|     while ($profiles_query->have_posts()) {
 | |
|         $profiles_query->the_post();
 | |
|         $profile_id = get_the_ID();
 | |
|         $user_id = get_post_meta($profile_id, 'user_id', true);
 | |
|         $is_public = get_post_meta($profile_id, 'is_public_profile', true);
 | |
|         $trainer_name = get_post_meta($profile_id, 'trainer_display_name', true);
 | |
|         
 | |
|         echo "  - Profile ID: $profile_id, User ID: $user_id, Public: $is_public, Name: $trainer_name\n";
 | |
|     }
 | |
| }
 | |
| wp_reset_postdata();
 | |
| 
 | |
| // 3. Check user account statuses
 | |
| echo "\n3. Checking user account statuses...\n";
 | |
| $user_query = new WP_User_Query([
 | |
|     'meta_query' => [
 | |
|         [
 | |
|             'key' => 'account_status',
 | |
|             'value' => ['approved', 'active', 'inactive'],
 | |
|             'compare' => 'IN'
 | |
|         ]
 | |
|     ],
 | |
|     'fields' => 'ID'
 | |
| ]);
 | |
| $approved_user_ids = $user_query->get_results();
 | |
| echo "Found " . count($approved_user_ids) . " approved users: " . implode(', ', $approved_user_ids) . "\n";
 | |
| 
 | |
| // 4. Check all users with HVAC roles
 | |
| echo "\n4. Checking users with HVAC roles...\n";
 | |
| $hvac_users = get_users([
 | |
|     'role__in' => ['hvac_trainer', 'hvac_master_trainer'],
 | |
|     'fields' => 'all'
 | |
| ]);
 | |
| 
 | |
| echo "Found " . count($hvac_users) . " HVAC users:\n";
 | |
| foreach ($hvac_users as $user) {
 | |
|     $account_status = get_user_meta($user->ID, 'account_status', true);
 | |
|     echo "  - User ID: {$user->ID}, Name: {$user->display_name}, Role: " . implode(', ', $user->roles) . ", Status: $account_status\n";
 | |
| }
 | |
| 
 | |
| // 5. Run the exact same query as the template
 | |
| echo "\n5. Running exact template query...\n";
 | |
| $approved_user_ids = $user_query->get_results();
 | |
| 
 | |
| if (!empty($approved_user_ids)) {
 | |
|     $template_args = [
 | |
|         'post_type' => 'trainer_profile',
 | |
|         'posts_per_page' => 12,
 | |
|         'post_status' => 'publish',
 | |
|         'meta_query' => [
 | |
|             'relation' => 'AND',
 | |
|             [
 | |
|                 'key' => 'is_public_profile',
 | |
|                 'value' => '1',
 | |
|                 'compare' => '='
 | |
|             ],
 | |
|             [
 | |
|                 'key' => 'user_id',
 | |
|                 'value' => $approved_user_ids,
 | |
|                 'compare' => 'IN'
 | |
|             ]
 | |
|         ]
 | |
|     ];
 | |
|     
 | |
|     $template_query = new WP_Query($template_args);
 | |
|     echo "Template query found: {$template_query->found_posts} posts\n";
 | |
|     
 | |
|     if ($template_query->have_posts()) {
 | |
|         while ($template_query->have_posts()) {
 | |
|             $template_query->the_post();
 | |
|             $profile_id = get_the_ID();
 | |
|             $user_id = get_post_meta($profile_id, 'user_id', true);
 | |
|             $name = get_post_meta($profile_id, 'trainer_display_name', true);
 | |
|             echo "  - Would display: $name (Profile ID: $profile_id, User ID: $user_id)\n";
 | |
|         }
 | |
|     }
 | |
|     wp_reset_postdata();
 | |
| } else {
 | |
|     echo "❌ No approved users found - template query will return empty\n";
 | |
| }
 | |
| 
 | |
| // 6. Check certification manager
 | |
| echo "\n6. Checking certification manager...\n";
 | |
| if (class_exists('HVAC_Trainer_Certification_Manager')) {
 | |
|     echo "✅ HVAC_Trainer_Certification_Manager class is available\n";
 | |
|     $cert_manager = HVAC_Trainer_Certification_Manager::instance();
 | |
|     
 | |
|     // Test with a user ID
 | |
|     if (!empty($hvac_users)) {
 | |
|         $test_user = $hvac_users[0];
 | |
|         $certifications = $cert_manager->get_active_trainer_certifications($test_user->ID);
 | |
|         echo "  - Test user {$test_user->display_name} has " . count($certifications) . " active certifications\n";
 | |
|     }
 | |
| } else {
 | |
|     echo "❌ HVAC_Trainer_Certification_Manager class is NOT available\n";
 | |
| }
 | |
| 
 | |
| // 7. Check if find-a-trainer page exists
 | |
| echo "\n7. Checking find-a-trainer page...\n";
 | |
| $find_trainer_page = get_page_by_path('find-a-trainer');
 | |
| if ($find_trainer_page) {
 | |
|     echo "✅ find-a-trainer page exists (ID: {$find_trainer_page->ID})\n";
 | |
|     echo "  - Template: " . get_page_template_slug($find_trainer_page->ID) . "\n";
 | |
|     echo "  - Status: {$find_trainer_page->post_status}\n";
 | |
| } else {
 | |
|     echo "❌ find-a-trainer page does not exist\n";
 | |
| }
 | |
| 
 | |
| echo "\n🎯 DEBUGGING SUMMARY:\n";
 | |
| echo "=====================\n";
 | |
| echo "This debug script should help identify why the find-a-trainer page is empty.\n";
 | |
| echo "Check each section above for any ❌ errors that need to be addressed.\n";
 | |
| ?>
 |