#!/bin/bash

# Fix Manage Event Page Shortcode
# Updates the manage event page to use proper TEC shortcode logic

echo "=== Fixing Manage Event Page Shortcode ==="

# SSH to staging and update the page content
ssh roodev@146.190.76.204 << 'ENDSSH'
cd /home/974670.cloudwaysapps.com/uberrxmprk/public_html

# Find the manage event page
echo "Finding manage event page..."
page_id=$(wp post list --post_type=page --name="manage-event" --field=ID --format=ids)

if [ -n "$page_id" ]; then
    echo "Found manage event page with ID: $page_id"
    
    # Update the page content to use the new shortcode logic
    wp post update "$page_id" --post_content="[hvac_manage_event]"
    
    echo "✅ Updated manage event page content"
    
    # Clear cache
    wp cache flush
    wp breeze purge --all
    
    echo "✅ Cache cleared"
else
    echo "❌ Manage event page not found"
fi

ENDSSH

echo "=== Script Complete ==="