upskill-event-manager/scripts/verify-trainer-data.sh
bengizmo 9055cddae5 feat: Implement comprehensive Find a Trainer feature with MapGeo integration
- Created Find a Trainer page with interactive map and trainer directory
- Integrated MapGeo plugin for displaying 45+ geocoded trainer locations
- Built advanced filtering system (State/Province, Business Type, Training Format, Training Resources)
- Implemented trainer profile cards with View Profile and See Events buttons
- Added contact form handler with validation and email notifications
- Created database table for tracking contact submissions
- Responsive design with mobile-friendly layout
- AJAX-powered search and filter functionality
- Pagination support for trainer directory
- Call to action for trainer registration

Technical Implementation:
- HVAC_Find_Trainer_Page: Main page handler with custom template
- HVAC_MapGeo_Integration: Map marker management for trainer locations
- HVAC_Contact_Form_Handler: Form processing with rate limiting
- HVAC_Trainer_Directory_Query: Advanced querying with caching
- HVAC_Contact_Submissions_Table: Database operations for submissions

Tested with existing 53 trainer profiles, 45 geocoded locations
Page live at: /find-a-trainer/

Co-Authored-By: Ben Reed <ben@tealmaker.com>
2025-08-04 08:53:34 -03:00

98 lines
No EOL
2.8 KiB
Bash
Executable file

#!/bin/bash
# Verify existing trainer data on staging
# Usage: ./scripts/verify-trainer-data.sh
source .env
echo "=== Verifying Existing Trainer Data on Staging ==="
ssh -o StrictHostKeyChecking=no "$UPSKILL_STAGING_SSH_USER@$UPSKILL_STAGING_IP" << 'ENDSSH'
cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html
wp eval '
// Check trainer profiles
$profiles = get_posts([
"post_type" => "trainer_profile",
"post_status" => "publish",
"posts_per_page" => -1
]);
echo "=== Trainer Profile Statistics ===\n";
echo "Total trainer profiles: " . count($profiles) . "\n";
// Check for geocoded profiles
$geocoded = 0;
$public = 0;
$with_events = 0;
foreach ($profiles as $profile) {
$lat = get_post_meta($profile->ID, "latitude", true);
$lng = get_post_meta($profile->ID, "longitude", true);
if ($lat && $lng) {
$geocoded++;
}
$is_public = get_post_meta($profile->ID, "is_public_profile", true);
if ($is_public == "1") {
$public++;
}
$user_id = get_post_meta($profile->ID, "user_id", true);
if ($user_id && function_exists("tribe_get_events")) {
$events = tribe_get_events([
"author" => $user_id,
"posts_per_page" => 1
]);
if (!empty($events)) {
$with_events++;
}
}
}
echo "Geocoded profiles: $geocoded\n";
echo "Public profiles: $public\n";
echo "Profiles with events: $with_events\n";
// Check users with trainer roles
$trainers = get_users(["role" => "hvac_trainer"]);
$master_trainers = get_users(["role" => "hvac_master_trainer"]);
echo "\n=== User Statistics ===\n";
echo "Users with hvac_trainer role: " . count($trainers) . "\n";
echo "Users with hvac_master_trainer role: " . count($master_trainers) . "\n";
// Check taxonomies
$taxonomies = ["business_type", "training_formats", "training_resources", "training_audience"];
echo "\n=== Taxonomy Statistics ===\n";
foreach ($taxonomies as $tax) {
if (taxonomy_exists($tax)) {
$terms = get_terms(["taxonomy" => $tax, "hide_empty" => false]);
if (!is_wp_error($terms)) {
echo "$tax: " . count($terms) . " terms\n";
}
}
}
// Sample some trainer data
echo "\n=== Sample Trainer Data (First 5) ===\n";
$sample_profiles = array_slice($profiles, 0, 5);
foreach ($sample_profiles as $profile) {
$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);
$lat = get_post_meta($profile->ID, "latitude", true);
$lng = get_post_meta($profile->ID, "longitude", true);
echo "- $name ($city, $state)";
if ($lat && $lng) {
echo " [Geocoded]";
}
echo "\n";
}
'
ENDSSH
echo "=== Data Verification Complete ==="