Please log in to view your training leads.

'; } // Check user capabilities $user = wp_get_current_user(); if (!in_array('hvac_trainer', $user->roles) && !in_array('hvac_master_trainer', $user->roles) && !current_user_can('manage_options')) { return '

You do not have permission to view this page.

'; } // Get current user $current_user = wp_get_current_user(); // Get submissions for this trainer $submissions = $this->get_trainer_submissions($current_user->ID); ob_start(); ?>

Training Leads

Manage contact requests from potential training clients

Date Name Email Phone Location Message Status Actions
submission_date))); ?> first_name . ' ' . $submission->last_name); ?> email); ?> phone) : ?> phone); ?> city, $submission->state_province ]); if (!empty($location_parts)) { echo esc_html(implode(', ', $location_parts)); } else { echo ''; } ?> message) : ?>
message, 8, '...')); ?>
message) > 50) : ?>
status)); ?>
status === 'new') : ?> status !== 'replied') : ?>

No inbound training requests

When potential clients contact you through the "Find a Trainer" directory, their messages will appear here.

Want more training leads?

Share your profile with the world to attract more potential clients!

Share your profile with the world!
$trainer_id, 'limit' => 100, 'orderby' => 'submission_date', 'order' => 'DESC' ]); } /** * AJAX handler to update lead status */ public function ajax_update_lead_status() { check_ajax_referer('hvac_ajax_nonce', 'nonce'); $user = wp_get_current_user(); if (!is_user_logged_in() || (!in_array('hvac_trainer', $user->roles) && !in_array('hvac_master_trainer', $user->roles) && !current_user_can('manage_options'))) { wp_send_json_error(['message' => 'Unauthorized']); } $lead_id = isset($_POST['lead_id']) ? absint($_POST['lead_id']) : 0; $status = isset($_POST['status']) ? sanitize_text_field($_POST['status']) : ''; if (!$lead_id || !$status) { wp_send_json_error(['message' => 'Invalid parameters']); } // Verify the lead belongs to the current user if (!$this->verify_lead_ownership($lead_id, get_current_user_id())) { wp_send_json_error(['message' => 'Access denied']); } if (!class_exists('HVAC_Contact_Submissions_Table')) { require_once HVAC_PLUGIN_DIR . 'includes/database/class-hvac-contact-submissions-table.php'; } $result = HVAC_Contact_Submissions_Table::update_status($lead_id, $status); if ($result) { wp_send_json_success(['message' => 'Status updated successfully']); } else { wp_send_json_error(['message' => 'Failed to update status']); } } /** * AJAX handler to mark lead as replied */ public function ajax_mark_lead_replied() { check_ajax_referer('hvac_ajax_nonce', 'nonce'); $user = wp_get_current_user(); if (!is_user_logged_in() || (!in_array('hvac_trainer', $user->roles) && !in_array('hvac_master_trainer', $user->roles) && !current_user_can('manage_options'))) { wp_send_json_error(['message' => 'Unauthorized']); } $lead_id = isset($_POST['lead_id']) ? absint($_POST['lead_id']) : 0; if (!$lead_id) { wp_send_json_error(['message' => 'Invalid lead ID']); } // Verify the lead belongs to the current user if (!$this->verify_lead_ownership($lead_id, get_current_user_id())) { wp_send_json_error(['message' => 'Access denied']); } if (!class_exists('HVAC_Contact_Submissions_Table')) { require_once HVAC_PLUGIN_DIR . 'includes/database/class-hvac-contact-submissions-table.php'; } $result = HVAC_Contact_Submissions_Table::update_status($lead_id, 'replied'); if ($result) { wp_send_json_success(['message' => 'Lead marked as replied']); } else { wp_send_json_error(['message' => 'Failed to update status']); } } /** * Verify that a lead belongs to the current user */ private function verify_lead_ownership($lead_id, $user_id) { if (!class_exists('HVAC_Contact_Submissions_Table')) { require_once HVAC_PLUGIN_DIR . 'includes/database/class-hvac-contact-submissions-table.php'; } $submission = HVAC_Contact_Submissions_Table::get_submission($lead_id); return $submission && $submission->trainer_id == $user_id; } } // Initialize the class HVAC_Training_Leads::get_instance();