#!/bin/bash # Debug dashboard live on server # Get absolute path to this script's directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Navigate to wordpress-dev directory cd "$(dirname "$SCRIPT_DIR")" || exit 1 # Load environment variables ENV_FILE=".env" if [ ! -f "$ENV_FILE" ]; then echo "Error: .env file not found at: $ENV_FILE" exit 1 fi source "$ENV_FILE" echo "=== Debugging Dashboard Live ===" echo "Remote host: $UPSKILL_STAGING_IP" echo "===============================" # Debug dashboard sshpass -p "${UPSKILL_STAGING_PASS}" ssh -o StrictHostKeyChecking=no "${UPSKILL_STAGING_SSH_USER}@${UPSKILL_STAGING_IP}" <<'EOF' cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html # Create debug script cat > debug-dashboard.php << 'PHP' ID; echo "test_trainer user ID: $user_id\n\n"; // Test dashboard data directly require_once $plugin_file; $dashboard = new HVAC_Dashboard_Data($user_id); echo "Direct method calls:\n"; echo "Total events: " . $dashboard->get_total_events_count() . "\n"; echo "Upcoming events: " . $dashboard->get_upcoming_events_count() . "\n"; echo "Past events: " . $dashboard->get_past_events_count() . "\n\n"; // Test a raw query echo "Raw query test:\n"; $args = array( 'post_type' => 'tribe_events', 'author' => $user_id, 'posts_per_page' => -1, 'post_status' => 'any' ); $query = new WP_Query($args); echo "Found: " . $query->found_posts . "\n"; echo "SQL: " . $query->request . "\n\n"; // Check cache echo "Cache status:\n"; $cache_group = 'counts'; $cache_key = 'hvac_events_' . $user_id; $cached = wp_cache_get($cache_key, $cache_group); echo "Cached value: " . var_export($cached, true) . "\n"; // Clear cache and try again wp_cache_flush(); echo "\nAfter cache flush:\n"; echo "Total events: " . $dashboard->get_total_events_count() . "\n"; PHP php debug-dashboard.php rm debug-dashboard.php EOF echo "Debug completed!"