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 event count $event_count = 0; if ($user_id && function_exists('tribe_get_events')) { $events = tribe_get_events([ 'author' => $user_id, 'eventDisplay' => 'all', 'posts_per_page' => -1, 'fields' => 'ids' ]); $event_count = count($events); } // Get upcoming events $upcoming_events = []; if ($user_id && function_exists('tribe_get_events')) { $events = tribe_get_events([ 'author' => $user_id, 'eventDisplay' => 'list', 'posts_per_page' => 5, 'start_date' => 'now' ]); foreach ($events as $event) { $upcoming_events[] = [ 'title' => $event->post_title, 'date' => tribe_get_start_date($event->ID, false, 'M j, Y'), 'url' => get_permalink($event->ID) ]; } } // 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 real event count for this trainer $event_count = 0; if ($user_id && function_exists('tribe_get_events')) { $events = tribe_get_events([ 'author' => $user_id, 'eventDisplay' => 'all', 'posts_per_page' => -1, 'fields' => 'ids' ]); $event_count = count($events); } $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' => get_post_meta($profile_id, 'certification_type', true), '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']); }); } // Enqueue required scripts and styles wp_enqueue_style('hvac-find-trainer', HVAC_PLUGIN_URL . 'assets/css/find-trainer.css', [], HVAC_VERSION); wp_enqueue_script('hvac-find-trainer', HVAC_PLUGIN_URL . 'assets/js/find-trainer.js', ['jquery'], HVAC_VERSION, true); wp_enqueue_style('dashicons'); // Enqueue profile sharing assets if showing direct profile if ($show_direct_profile) { wp_enqueue_style('hvac-profile-sharing', HVAC_PLUGIN_URL . 'assets/css/hvac-profile-sharing.css', ['hvac-find-trainer'], HVAC_VERSION); wp_enqueue_script('hvac-profile-sharing', HVAC_PLUGIN_URL . 'assets/js/hvac-profile-sharing.js', ['jquery', 'hvac-find-trainer'], HVAC_VERSION, true); // Localize sharing script with nonce and AJAX URL wp_localize_script('hvac-profile-sharing', 'hvac_sharing', [ 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('hvac_profile_sharing'), 'profile_id' => $direct_profile_id ]); } // Localize script with necessary data wp_localize_script('hvac-find-trainer', 'hvac_find_trainer', [ 'ajax_url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('hvac_find_trainer'), 'map_id' => '5872', 'direct_profile_id' => $direct_profile_id ?: null, 'show_direct_profile' => $show_direct_profile, 'messages' => [ 'loading' => __('Loading...', 'hvac'), 'error' => __('An error occurred. Please try again.', 'hvac'), 'no_results' => __('No trainers found matching your criteria.', 'hvac'), 'form_error' => __('Please check the form and try again.', 'hvac'), 'form_success' => __('Your message has been sent! Check your inbox for more details.', 'hvac') ] ]); ?>
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
Are you an HVAC Trainer that wants to be listed in our directory?
Become A Trainer