upskill-event-manager/scripts/analyze-mapgeo-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

117 lines
No EOL
3.5 KiB
Bash
Executable file

#!/bin/bash
# Analyze MapGeo data structure
# Usage: ./scripts/analyze-mapgeo-data.sh
source .env
echo "=== Analyzing MapGeo Data Structure ==="
ssh -o StrictHostKeyChecking=no "$UPSKILL_STAGING_SSH_USER@$UPSKILL_STAGING_IP" << 'ENDSSH'
cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html
echo "=== Getting map metadata for ID 5872 ==="
wp eval '
$map_id = 5872;
$meta = get_post_meta($map_id);
echo "Post meta keys for map $map_id:\n";
foreach ($meta as $key => $values) {
if (strpos($key, "_") !== 0) { // Skip private meta
echo " $key: ";
$value = $values[0];
if (is_serialized($value)) {
$unserialized = unserialize($value);
if (is_array($unserialized)) {
echo "array with " . count($unserialized) . " items\n";
if (isset($unserialized["markers"])) {
echo " - Has markers: " . count($unserialized["markers"]) . "\n";
}
if (isset($unserialized["regions"])) {
echo " - Has regions: " . count($unserialized["regions"]) . "\n";
}
} else {
echo gettype($unserialized) . "\n";
}
} else {
echo substr($value, 0, 100) . (strlen($value) > 100 ? "..." : "") . "\n";
}
}
}
'
echo -e "\n=== Checking igm_maps option ==="
wp eval '
$maps_data = get_option("igm_maps");
if ($maps_data) {
echo "igm_maps option exists\n";
if (is_array($maps_data)) {
echo "Contains " . count($maps_data) . " maps\n";
if (isset($maps_data[5872])) {
echo "Map 5872 data found in option\n";
$map = $maps_data[5872];
if (is_array($map)) {
echo "Map data keys: " . implode(", ", array_keys($map)) . "\n";
}
}
}
} else {
echo "No igm_maps option found\n";
}
'
echo -e "\n=== Testing igm_add_meta filter directly ==="
wp eval '
// Simulate what the plugin does
$map_id = 5872;
$meta = get_post_meta($map_id, "map_info", true);
if ($meta) {
echo "Original meta structure:\n";
echo " Type: " . gettype($meta) . "\n";
if (is_array($meta)) {
echo " Keys: " . implode(", ", array_keys($meta)) . "\n";
if (isset($meta["id"])) {
echo " Map ID in meta: " . $meta["id"] . "\n";
}
}
// Apply the filter as the plugin would
echo "\nApplying igm_add_meta filter...\n";
$filtered = apply_filters("igm_add_meta", $meta);
if ($filtered !== $meta) {
echo "Meta was modified by filters\n";
if (is_array($filtered)) {
echo " New keys: " . implode(", ", array_keys($filtered)) . "\n";
}
} else {
echo "Meta unchanged by filters\n";
}
} else {
echo "No map_info meta found for map $map_id\n";
}
'
echo -e "\n=== Checking how maps are rendered ==="
wp eval '
// Check what happens when we render a map
echo "Attempting to render map 5872...\n";
$shortcode_output = do_shortcode("[display-map id=\"5872\"]");
if (strpos($shortcode_output, "error") !== false || strpos($shortcode_output, "Error") !== false) {
echo "Error in shortcode output: " . strip_tags($shortcode_output) . "\n";
} else {
echo "Shortcode rendered successfully\n";
// Check if it contains expected elements
if (strpos($shortcode_output, "igm-map") !== false) {
echo " Contains igm-map element\n";
}
if (strpos($shortcode_output, "data-map-id") !== false) {
echo " Contains data-map-id attribute\n";
}
}
'
ENDSSH
echo "=== Analysis Complete ==="