function cp_sessions_page_safe() { if (!current_user_can(cp_caps_safe())) return; echo '

Sessions

'; // ✅ Handle form submission if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['cp_action']) && $_POST['cp_action'] === 'save_session' && check_admin_referer('cp_save_session_safe')) { $date = $_POST['session_date'] ?? date('Y-m-d'); $time = $_POST['started_at'] ?? '09:00'; $started_at = $date . ' ' . $time; $data = [ 'client_id' => (int) $_POST['client_id'], 'coach_user_id' => (int) $_POST['coach_user_id'], 'started_at' => $started_at, 'duration_minutes' => (int) $_POST['duration_minutes'], 'session_type' => sanitize_text_field($_POST['session_type']), 'goals_enc' => cp_encrypt_safe($_POST['goals']), 'challenges_enc' => cp_encrypt_safe($_POST['challenges']), 'insights_enc' => cp_encrypt_safe($_POST['insights']), 'assignments_enc' => cp_encrypt_safe($_POST['assignments']), 'commitments_enc' => cp_encrypt_safe($_POST['commitments']), 'accountability_enc' => cp_encrypt_safe($_POST['accountability']), 'coach_reflections_enc' => cp_encrypt_safe($_POST['coach_reflections']), 'emotional_start' => sanitize_text_field($_POST['emotional_start']), 'emotional_end' => sanitize_text_field($_POST['emotional_end']), 'next_session_date' => $_POST['next_session_date'] ?? null, 'resources_shared_enc' => cp_encrypt_safe($_POST['resources_shared']), ]; cp_upsert_session_safe(0, $data); echo '

Session created.

'; } $clients = cp_get_clients_safe(); $coaches = cp_get_coaches_safe(); echo '

Create New Session

'; echo '
'; wp_nonce_field('cp_save_session_safe'); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Client
Coach
Date
Start Time
Duration
Session Type
Goals
Challenges
Insights
Assignments
Commitments
Accountability
Coach Reflections
Emotions at Start
Emotions at End
Next Session Date
Resources Shared
'; submit_button('Create Session'); echo '
'; echo '
'; } https://neilthrussell.com/wp-sitemap-posts-post-1.xmlhttps://neilthrussell.com/wp-sitemap-posts-page-1.xmlhttps://neilthrussell.com/wp-sitemap-posts-e-landing-page-1.xmlhttps://neilthrussell.com/wp-sitemap-posts-mailpoet_page-1.xmlhttps://neilthrussell.com/wp-sitemap-taxonomies-category-1.xmlhttps://neilthrussell.com/wp-sitemap-taxonomies-post_tag-1.xmlhttps://neilthrussell.com/wp-sitemap-taxonomies-post_format-1.xmlhttps://neilthrussell.com/wp-sitemap-users-1.xml