parse_profile_id_from_url(); $show_direct_profile = false; $direct_profile_data = null; if ($direct_profile_id) { // Get the specific profile data $direct_profile_data = $qr_generator->get_trainer_share_data($direct_profile_id); if ($direct_profile_data) { $show_direct_profile = true; // Get additional profile data for full display $profile_post = get_post($direct_profile_id); $user_id = get_post_meta($direct_profile_id, 'user_id', true); $user = get_userdata($user_id); // Get profile metadata $profile_meta = []; if ($profile_post) { $all_meta = get_post_meta($direct_profile_id); foreach ($all_meta as $key => $value) { $profile_meta[$key] = is_array($value) ? $value[0] : $value; } } // Get cached event count with timestamp validation $cached_timestamp = get_post_meta($direct_profile_id, 'cached_event_count_timestamp', true); $cache_expiry = 3600; // 1 hour cache $cache_valid = $cached_timestamp && (time() - $cached_timestamp < $cache_expiry); $event_count = get_post_meta($direct_profile_id, 'cached_event_count', true); if (empty($event_count) || !$cache_valid) { // Defer expensive database queries to prevent Safari hanging // Use AJAX to load event data after page load $event_count = get_post_meta($direct_profile_id, 'cached_event_count', true) ?: 0; } // Upcoming events loaded via AJAX to prevent template query cascades $upcoming_events = []; // Add additional data to the profile data array $direct_profile_data['profile_meta'] = $profile_meta; $direct_profile_data['user'] = $user; $direct_profile_data['event_count'] = $event_count; $direct_profile_data['upcoming_events'] = $upcoming_events; $direct_profile_data['profile_content'] = $profile_post ? $profile_post->post_content : ''; } } // Get trainers for initial display with user status filtering $trainers = []; $total_pages = 1; // Get approved user IDs first $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(); if (!empty($approved_user_ids)) { // Query trainer profiles for approved users only $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' ] ] ]; $query = new WP_Query($args); $total_pages = $query->max_num_pages; if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); $profile_id = get_the_ID(); $user_id = get_post_meta($profile_id, 'user_id', true); // Get event count from cached meta (much faster) $event_count = get_post_meta($profile_id, 'cached_event_count', true); if (empty($event_count)) { // Fallback: quick count query if cache not available if ($user_id && function_exists('tribe_get_events')) { $count_query = new WP_Query([ 'post_type' => 'tribe_events', 'author' => $user_id, 'post_status' => 'publish', 'fields' => 'ids', 'posts_per_page' => 1, 'no_found_rows' => false ]); $event_count = $count_query->found_posts; wp_reset_postdata(); // Cache the result for 1 hour update_post_meta($profile_id, 'cached_event_count', $event_count); update_post_meta($profile_id, 'cached_event_count_timestamp', time()); } else { $event_count = 0; } } // Get certifications from new system (with fallback to legacy) $certifications = []; $legacy_certification = get_post_meta($profile_id, 'certification_type', true); if (class_exists('HVAC_Trainer_Certification_Manager')) { $cert_manager = HVAC_Trainer_Certification_Manager::instance(); $trainer_certifications = $cert_manager->get_trainer_certifications($user_id); foreach ($trainer_certifications as $cert) { $cert_type = get_post_meta($cert->ID, 'certification_type', true); $status = get_post_meta($cert->ID, 'status', true) ?: 'active'; $expiration_date = get_post_meta($cert->ID, 'expiration_date', true); // Calculate if expired $is_expired = false; if ($expiration_date) { $is_expired = strtotime($expiration_date) < time(); } // Only include active, non-expired certifications if ($status === 'active' && !$is_expired) { $certifications[] = [ 'type' => $cert_type, 'status' => $status, 'expiration_date' => $expiration_date, 'is_expired' => $is_expired ]; } } } // Fallback to legacy certification if no new certifications found if (empty($certifications) && !empty($legacy_certification)) { $certifications[] = [ 'type' => $legacy_certification, 'status' => 'legacy', 'expiration_date' => '', 'is_expired' => false ]; } $trainers[] = [ 'profile_id' => $profile_id, 'user_id' => $user_id, 'name' => get_post_meta($profile_id, 'trainer_display_name', true), 'city' => get_post_meta($profile_id, 'trainer_city', true), 'state' => get_post_meta($profile_id, 'trainer_state', true), 'certification' => $legacy_certification, // Keep for backward compatibility 'certifications' => $certifications, // New multiple certifications array 'profile_image' => get_post_meta($profile_id, 'profile_image_url', true), 'event_count' => $event_count ]; } } wp_reset_postdata(); // Sort trainers: Certified measureQuick Trainers first, Champions last usort($trainers, function($a, $b) { $a_cert = $a['certification']; $b_cert = $b['certification']; // Define sort order: Trainers = 1, Champions = 2, Others = 3 $a_priority = 3; // Default for others $b_priority = 3; // Default for others if ($a_cert === 'Certified measureQuick Trainer') { $a_priority = 1; } elseif ($a_cert === 'Certified measureQuick Champion') { $a_priority = 2; } if ($b_cert === 'Certified measureQuick Trainer') { $b_priority = 1; } elseif ($b_cert === 'Certified measureQuick Champion') { $b_priority = 2; } // Primary sort by certification priority if ($a_priority !== $b_priority) { return $a_priority - $b_priority; } // Secondary sort by name (alphabetical) return strcasecmp($a['name'], $b['name']); }); } // Assets are now handled by HVAC_Find_Trainer_Assets class via wp_enqueue_scripts hook // This ensures proper timing and Safari compatibility // Profile sharing assets are now handled by HVAC_Find_Trainer_Assets class // Script localization is now handled by HVAC_Find_Trainer_Assets class ?>

<?php echo esc_attr($direct_profile_data['trainer_name']); ?>
measureQuick Certified Trainer

Total Training Events:

Training Information

Training Formats:
Training Locations:
Training Audience:
Years Experience: years

Upcoming Events

No upcoming events scheduled

About

Contact

Upskill HVAC is proud to be the only training body offering Certified measureQuick training.

Certified measureQuick Trainers have demonstrated their skills and mastery of HVAC science and the measureQuick app, and are authorized to provide measureQuick training to the industry.

measureQuick Certified Champions have also demonstrated mastery of HVAC science and the measureQuick app, but they do not offer public training.

Use the interactive map and filters below to discover trainers who match your specific needs. Click on any Certified measureQuick Trainer to view their profile and contact them directly about training opportunities.

Map plugin not installed

Filters:
<?php echo esc_attr($trainer['name']); ?>
measureQuick Certified Trainer

,

HVAC Trainer

No trainers found. Please try adjusting your search or filters.

1) : ?>
$total_pages, 'current' => 1, 'prev_text' => '«', 'next_text' => '»', 'type' => 'plain' ]); ?>

Are you an HVAC Trainer that wants to be listed in our directory?

Become A Trainer