upskill-event-manager/includes/zoho/STAGING-MODE.md
bengizmo 37f4180e1c feat: Add massive missing plugin infrastructure to repository
🚨 CRITICAL: Fixed deployment blockers by adding missing core directories:

**Community System (CRITICAL)**
- includes/community/ - Login_Handler and all community classes
- templates/community/ - Community login forms

**Certificate System (CRITICAL)**
- includes/certificates/ - 8+ certificate classes and handlers
- templates/certificates/ - Certificate reports and generation templates

**Core Individual Classes (CRITICAL)**
- includes/class-hvac-event-summary.php
- includes/class-hvac-trainer-profile-manager.php
- includes/class-hvac-master-dashboard-data.php
- Plus 40+ other individual HVAC classes

**Major Feature Systems (HIGH)**
- includes/database/ - Training leads database tables
- includes/find-trainer/ - Find trainer directory and MapGeo integration
- includes/google-sheets/ - Google Sheets integration system
- includes/zoho/ - Complete Zoho CRM integration
- includes/communication/ - Communication templates system

**Template Infrastructure**
- templates/attendee/, templates/email-attendees/
- templates/event-summary/, templates/status/
- templates/template-parts/ - Shared template components

**Impact:**
- 70+ files added covering 10+ missing directories
- Resolves ALL deployment blockers and feature breakdowns
- Plugin activation should now work correctly
- Multi-machine deployment fully supported

🔧 Generated with Claude Code

Co-Authored-By: Ben Reed <ben@tealmaker.com>
2025-08-11 13:30:11 -03:00

2.6 KiB

Zoho CRM Integration - Staging Mode

Overview

The Zoho CRM integration has a built-in staging mode to prevent accidental data synchronization from development or staging environments to the production Zoho CRM database.

How It Works

Domain Detection

  • Production Domain: upskillhvac.com
  • Staging Domains: All other domains (e.g., *.cloudwaysapps.com)

Staging Mode Behavior

When running on any domain other than upskillhvac.com:

  1. Read Operations: Allowed (GET requests)
  2. Write Operations: Blocked (POST, PUT, DELETE, PATCH requests)
  3. Visual Indicators: Admin interface shows "STAGING MODE ACTIVE" banner
  4. Sync Simulation: Shows what data would be synced without actually sending it

Production Mode

When running on upskillhvac.com:

  • All operations are allowed
  • Data syncs directly to Zoho CRM
  • No staging mode indicators

Admin Interface

Staging Mode Indicators

  • Blue info banner at the top of the Zoho CRM Sync page
  • Shows current site URL
  • Displays "STAGING MODE - Simulation Results" on sync operations

Test Data Preview

In staging mode, sync operations return:

  • Total records that would be synced
  • Detailed preview of first 5 records
  • Field mappings that would be used

Implementation Details

Class: HVAC_Zoho_Sync

private function is_sync_allowed() {
    $site_url = get_site_url();
    return strpos($site_url, 'upskillhvac.com') !== false;
}

Class: HVAC_Zoho_CRM_Auth

// Blocks write operations in staging mode
if ($is_staging && in_array($method, array('POST', 'PUT', 'DELETE', 'PATCH'))) {
    return [simulated response];
}

Testing in Staging

  1. Access WordPress Admin → HVAC Community Events → Zoho CRM Sync
  2. See "STAGING MODE ACTIVE" banner
  3. Click sync buttons to see simulated results
  4. Review test data in expandable preview sections
  5. No actual data is sent to Zoho CRM

Deploying to Production

  1. Deploy code to upskillhvac.com
  2. Staging mode automatically deactivates
  3. Sync operations will write to Zoho CRM
  4. Monitor first sync carefully

Configuration

No configuration needed - staging mode is automatic based on domain detection.

Security Benefits

  • Prevents test data from polluting production CRM
  • Allows safe testing of sync logic
  • No configuration mistakes possible
  • Clear visual indicators prevent confusion

Troubleshooting

Staging Mode Not Activating

  • Check site URL with get_site_url()
  • Ensure domain doesn't contain "upskillhvac.com"

Production Sync Not Working

  • Verify site URL contains "upskillhvac.com"
  • Check OAuth credentials are configured
  • Review error logs for API issues