diff --git a/docs/10-MODULES/INTEGRATIONS.md b/docs/10-MODULES/INTEGRATIONS.md index c83410a3..81a99ee3 100644 --- a/docs/10-MODULES/INTEGRATIONS.md +++ b/docs/10-MODULES/INTEGRATIONS.md @@ -85,6 +85,10 @@ The Integrations module manages: ## Data Models +### Authentication Note + +**⚠️ Important:** For WordPress integrations, `Site.wp_api_key` is the **SINGLE source of truth** for API authentication, NOT SiteIntegration fields. The SiteIntegration model is used for sync tracking and multi-platform support (future: Shopify). + ### SiteIntegration | Field | Type | Purpose | @@ -92,14 +96,15 @@ The Integrations module manages: | account | FK | Owner account | | site | FK | IGNY8 site | | platform | CharField | wordpress/shopify | -| site_url | URLField | External site URL | -| api_key | CharField | WordPress Application Password | -| username | CharField | WordPress username | +| external_site_url | URLField | External site URL | | is_active | Boolean | Enable/disable | | sync_enabled | Boolean | Enable auto-sync | | last_sync_at | DateTime | Last sync time | -| sync_status | CharField | idle/syncing/error | -| metadata | JSON | Platform-specific data | +| sync_status | CharField | pending/syncing/completed/error | +| sync_error | TextField | Sync error message | +| connection_status | CharField | connected/error | +| config_json | JSON | Platform-specific configuration | +| credentials_json | JSON | (Reserved for future platforms, NOT used for WordPress) | | created_at | DateTime | Creation date | ### SyncEvent diff --git a/docs/60-PLUGINS/INDEX.md b/docs/60-PLUGINS/INDEX.md index 4cfa00bf..b3159fdb 100644 --- a/docs/60-PLUGINS/INDEX.md +++ b/docs/60-PLUGINS/INDEX.md @@ -48,10 +48,18 @@ The IGNY8 plugin distribution system provides a comprehensive infrastructure for | Platform | Plugin Name | Current Version | Status | |----------|-------------|-----------------|--------| -| WordPress | IGNY8 WP Bridge | 1.3.3 | Production | +| WordPress | IGNY8 WP Bridge | 1.5.1 | Production | | Shopify | IGNY8 Shopify | - | Infrastructure Ready | | Custom | IGNY8 Bridge | - | Infrastructure Ready | +### WordPress Plugin Admin Pages (v1.5.1) + +| Page | Purpose | +|------|---------| +| Dashboard | Connection status, Site ID, masked API key, content stats | +| Settings | Post types, default post status, taxonomies, sync toggle | +| Logs | Webhook activity with timestamps, event types, status | + ## System Features ### Distribution System @@ -96,6 +104,8 @@ Install/Update → Register Installation → Health Check ## Version Progression (Last 20 Commits) **WordPress Plugin Versions:** +- v1.5.1 - Admin UI consolidation (6→3 pages), header fixes +- v1.5.0 - Authentication simplification (Site.wp_api_key as single source) - v1.3.3 - Template design improvements, image layout fixes - v1.3.2 - Template fixes in app and plugin - v1.3.1 - WordPress plugin updates @@ -103,6 +113,8 @@ Install/Update → Register Installation → Health Check **Infrastructure Updates:** - Plugin distribution system implemented (v1.7.0) +- Authentication simplified to Site.wp_api_key (single source of truth) +- SiteIntegration model retained for sync tracking (not auth) - Database models for multi-platform support - API endpoints for lifecycle management - Automated packaging and versioning diff --git a/docs/60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md b/docs/60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md index 2f99868e..a9ecf6d8 100644 --- a/docs/60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md +++ b/docs/60-PLUGINS/PLUGIN-UPDATE-WORKFLOW.md @@ -33,6 +33,8 @@ Django Admin → Add Plugin Version → Enter 3 fields → Save → Change statu | Version | Date | Type | Key Changes | |---------|------|------|-------------| +| 1.5.1 | Jan 10, 2026 | Minor | Admin UI consolidation: 6→3 pages (Dashboard, Settings, Logs), header alignment fixes | +| 1.5.0 | Jan 10, 2026 | Minor | Authentication simplification: Site.wp_api_key as single source of truth | | 1.3.3 | Jan 10, 2026 | Patch | Template design: Square image grid fixes, landscape image positioning, direct border-radius/shadow on images without captions | | 1.3.2 | Jan 9, 2026 | Patch | Template fixes in app and plugin, image layout improvements | | 1.3.1 | Jan 9, 2026 | Patch | WordPress plugin versioning updates | diff --git a/docs/60-PLUGINS/WORDPRESS-INTEGRATION.md b/docs/60-PLUGINS/WORDPRESS-INTEGRATION.md index bcca5d5b..4877b600 100644 --- a/docs/60-PLUGINS/WORDPRESS-INTEGRATION.md +++ b/docs/60-PLUGINS/WORDPRESS-INTEGRATION.md @@ -122,12 +122,20 @@ This document covers the **app-side** management of WordPress integration: │ │ ├── igny8-bridge.php # Main plugin file │ │ ├── includes/ # PHP classes │ │ ├── admin/ # Admin interface +│ │ │ ├── class-admin.php # Menu registration +│ │ │ ├── layout-header.php # Layout wrapper + sidebar +│ │ │ ├── layout-footer.php # Footer +│ │ │ ├── settings.php # Settings handler +│ │ │ └── pages/ # Admin pages (3 pages) +│ │ │ ├── connection.php # Dashboard (connection + stats) +│ │ │ ├── settings.php # Post types, taxonomies, sync +│ │ │ └── logs.php # Webhook activity logs │ │ ├── sync/ # Sync functionality │ │ ├── templates/ # Frontend templates │ │ └── docs/ # Plugin-internal docs │ └── dist/ # Distribution files -│ ├── igny8-wp-bridge-v1.1.1.zip # Version ZIP -│ ├── igny8-wp-bridge-v1.1.1.sha256 +│ ├── igny8-wp-bridge-v1.x.x.zip # Version ZIP +│ ├── igny8-wp-bridge-v1.x.x.sha256 │ └── igny8-wp-bridge-latest.zip # Symlink to latest │ └── backend/ @@ -141,6 +149,21 @@ This document covers the **app-side** management of WordPress integration: └── urls.py # URL routing ``` +### Plugin Admin Pages + +The WordPress plugin provides 3 admin pages: + +| Page | File | Purpose | +|------|------|---------| +| Dashboard | `connection.php` | Connection status, Site ID, API key, content stats | +| Settings | `settings.php` | Post types, default post status, taxonomies, sync toggle | +| Logs | `logs.php` | Webhook activity with timestamps, event types, status | + +**Layout:** +- Dashboard: 2-column grid (Connection Status + Content Stats) +- Settings: 3-column top row (Post Types + Default Post Status + IGNY8 Sync) + dynamic taxonomy cards +- Logs: Full-width table with search + ### How ZIP Files Are Created #### Automatic Build (Recommended) @@ -523,19 +546,38 @@ The frontend shows: ### Integration Data Model +**Authentication (Source of Truth):** + ```python -# SiteIntegration model (in auth/models.py) +# Site model (in auth/models.py) - SINGLE source of truth for API auth + +class Site(models.Model): + wp_api_key = models.CharField(max_length=255) # API key for WP authentication + # Used by: PublisherService, test connection, plugin verification +``` + +**Sync Tracking (SiteIntegration):** + +```python +# SiteIntegration model (in auth/models.py) - Tracks sync status, NOT auth class SiteIntegration(models.Model): site = models.ForeignKey(Site, ...) # IGNY8 site - platform = models.CharField(...) # "wordpress" + platform = models.CharField(...) # "wordpress", "shopify" external_site_url = models.URLField() # WordPress URL - api_key = models.CharField(...) # Encrypted key sync_enabled = models.BooleanField() - last_sync = models.DateTimeField() + sync_status = models.CharField(...) # "pending", "syncing", "completed" + last_sync_at = models.DateTimeField() + sync_error = models.TextField(null=True) connection_status = models.CharField(...) # "connected", "error" ``` +**Key Architecture Points:** +- `Site.wp_api_key` is the **SINGLE source of truth** for API authentication +- `SiteIntegration` provides sync tracking but NOT authentication +- Publishing uses `Site.wp_api_key` via `X-IGNY8-API-KEY` header +- SiteIntegration kept for future multi-platform support (Shopify, custom) + --- ## 9. Troubleshooting @@ -638,7 +680,20 @@ unzip -p /data/app/igny8/plugins/wordpress/dist/igny8-wp-bridge-v1.1.1.zip \ - `/register/` - Installation registration - `/health-check/` - Plugin health monitoring -### WordPress Plugin Updates (v1.3.0 → v1.3.3) +### WordPress Plugin Updates (v1.3.0 → v1.5.1) + +**v1.5.1 - Admin UI Consolidation:** +- Reduced admin pages from 6 to 3: Dashboard, Settings, Logs +- Renamed Connection page to Dashboard with content stats +- Removed redundant pages: Data, Sync, old Dashboard +- Settings redesigned with 3-column layout (Post Types + Default Post Status + IGNY8 Sync) +- Fixed header alignment across all pages with proper width styling +- Cleaned up orphaned code and functions + +**v1.5.0 - Authentication Simplification:** +- Simplified authentication to use Site.wp_api_key as single source of truth +- Removed redundant access_token handling +- Improved test connection flow using authenticated /verify-key endpoint **v1.3.3 - Template Design Improvements:** - Fixed square images displaying in 2 rows (now side-by-side) @@ -665,11 +720,12 @@ unzip -p /data/app/igny8/plugins/wordpress/dist/igny8-wp-bridge-v1.1.1.zip \ ### Version Progression Timeline ``` -v1.7.0 (Jan 10, 2026) - App infrastructure + plugin v1.3.3 +v1.7.0 (Jan 10, 2026) - App infrastructure + plugin v1.5.1 + ├── Plugin admin UI consolidation (6→3 pages) + ├── Authentication simplification ├── Plugin distribution system complete ├── Template design overhaul - ├── Image layout fixes - └── Pre-launch cleanup (Phases 1, 5, 6) + └── Pre-launch cleanup complete v1.6.2 (Jan 8, 2026) - Design refinements └── Marketing site updates diff --git a/docs/90-REFERENCE/MODELS.md b/docs/90-REFERENCE/MODELS.md index 45ff802f..9130858b 100644 --- a/docs/90-REFERENCE/MODELS.md +++ b/docs/90-REFERENCE/MODELS.md @@ -523,28 +523,36 @@ class ContentImage(models.Model): ### SiteIntegration +**⚠️ Note:** For WordPress, `Site.wp_api_key` is the **SINGLE source of truth** for API authentication. SiteIntegration is used for sync tracking and future multi-platform support. + ```python class SiteIntegration(models.Model): id = UUIDField(primary_key=True) name = CharField(max_length=255) site = ForeignKey(Site, related_name='integrations') - platform = CharField(max_length=50) # wordpress + platform = CharField(max_length=50) # wordpress, shopify (future) - # Credentials (encrypted) - url = URLField() - username = CharField(max_length=255) - api_key = CharField(max_length=255) # Application password + # Configuration + external_site_url = URLField() + config_json = JSONField(default=dict) # Platform-specific settings + credentials_json = JSONField(default=dict) # Reserved for future platforms (NOT for WordPress) - # Cached structure + # Sync Tracking + sync_enabled = BooleanField(default=True) + sync_status = CharField(max_length=50) # pending/syncing/completed/error + last_sync_at = DateTimeField(null=True) + sync_error = TextField(null=True) + + # Connection + connection_status = CharField(max_length=50) # connected/error + is_active = BooleanField(default=True) + + # Cached WordPress structure (from initial sync) categories = JSONField(default=list) tags = JSONField(default=list) authors = JSONField(default=list) post_types = JSONField(default=list) - - # Status - is_active = BooleanField(default=True) - last_sync_at = DateTimeField(null=True) structure_updated_at = DateTimeField(null=True) created_at = DateTimeField(auto_now_add=True) diff --git a/plugins/wordpress/source/igny8-wp-bridge/admin/class-admin.php b/plugins/wordpress/source/igny8-wp-bridge/admin/class-admin.php index 84e10916..ce0cd3a5 100644 --- a/plugins/wordpress/source/igny8-wp-bridge/admin/class-admin.php +++ b/plugins/wordpress/source/igny8-wp-bridge/admin/class-admin.php @@ -79,15 +79,6 @@ class Igny8Admin { array($this, 'render_page') ); - add_submenu_page( - 'igny8-connection', - __('Data', 'igny8-bridge'), - __('Data', 'igny8-bridge'), - 'manage_options', - 'igny8-data', - array($this, 'render_page') - ); - add_submenu_page( 'igny8-connection', __('Logs', 'igny8-bridge'), @@ -281,9 +272,6 @@ class Igny8Admin { case 'igny8-settings': $template_file = IGNY8_BRIDGE_PLUGIN_DIR . 'admin/pages/settings.php'; break; - case 'igny8-data': - $template_file = IGNY8_BRIDGE_PLUGIN_DIR . 'admin/pages/data.php'; - break; case 'igny8-logs': $template_file = IGNY8_BRIDGE_PLUGIN_DIR . 'admin/pages/logs.php'; break; diff --git a/plugins/wordpress/source/igny8-wp-bridge/admin/layout-header.php b/plugins/wordpress/source/igny8-wp-bridge/admin/layout-header.php index 598c8a47..e2019b6f 100644 --- a/plugins/wordpress/source/igny8-wp-bridge/admin/layout-header.php +++ b/plugins/wordpress/source/igny8-wp-bridge/admin/layout-header.php @@ -64,16 +64,6 @@ $is_connected = !empty($api_key); -
  • - - - - - - -
  • -
  • diff --git a/plugins/wordpress/source/igny8-wp-bridge/admin/pages/connection.php b/plugins/wordpress/source/igny8-wp-bridge/admin/pages/connection.php index 31ce230d..63f88f25 100644 --- a/plugins/wordpress/source/igny8-wp-bridge/admin/pages/connection.php +++ b/plugins/wordpress/source/igny8-wp-bridge/admin/pages/connection.php @@ -41,7 +41,7 @@ $show_success = isset($_GET['connected']) && $_GET['connected'] === '1'; ?>
    -
    +

    diff --git a/plugins/wordpress/source/igny8-wp-bridge/admin/pages/data.php b/plugins/wordpress/source/igny8-wp-bridge/admin/pages/data.php deleted file mode 100644 index c6032ee9..00000000 --- a/plugins/wordpress/source/igny8-wp-bridge/admin/pages/data.php +++ /dev/null @@ -1,156 +0,0 @@ - - -
    -
    -
    -

    -

    -
    -
    - Plugin v - PHP -
    -
    -
    - - -
    -
    -
    -

    - - - - -

    -
    -
    -

    - -

    -
    -
    - -
    -
    -

    - - - - -

    -
    -
    -

    - -

    -
    -
    - -
    -
    -

    - - - - -

    -
    -
    -

    - -

    -
    -
    -
    - - - -
    -
    -

    - - - - -

    -
    - - - - - - - - - - - - - - - - - - - - -
    - post_title) : __('Unknown Post', 'igny8-bridge'); - ?> - - - - - - - - - - -
    - - 10): ?> -

    - -

    - -
    - -
    - - - - -
    - - - diff --git a/plugins/wordpress/source/igny8-wp-bridge/admin/pages/logs.php b/plugins/wordpress/source/igny8-wp-bridge/admin/pages/logs.php index 5b495538..88053fb8 100644 --- a/plugins/wordpress/source/igny8-wp-bridge/admin/pages/logs.php +++ b/plugins/wordpress/source/igny8-wp-bridge/admin/pages/logs.php @@ -18,7 +18,7 @@ $webhook_logs = igny8_get_webhook_logs(array('limit' => 20)); ?>
    -
    +

    diff --git a/plugins/wordpress/source/igny8-wp-bridge/admin/pages/settings.php b/plugins/wordpress/source/igny8-wp-bridge/admin/pages/settings.php index e70cd149..0499206f 100644 --- a/plugins/wordpress/source/igny8-wp-bridge/admin/pages/settings.php +++ b/plugins/wordpress/source/igny8-wp-bridge/admin/pages/settings.php @@ -1,7 +1,7 @@
    -
    +

    @@ -49,50 +49,130 @@ foreach ($all_post_types as $pt) {
    - -
    -
    -

    - - - - -

    -
    -

    - -

    + +
    -
    - $pt) : - $is_posts = ($slug === 'post'); - $is_enabled = in_array($slug, $enabled_post_types, true); - ?> -
    -

    - label)); ?> -

    - -
    +
    $tax) : - // Default enabled: category, post_tag, product_cat, product_tag, igny8_sectors, igny8_clusters - $default_enabled = in_array($tax_slug, array('category', 'post_tag', 'product_cat', 'product_tag', 'igny8_sectors', 'igny8_clusters'), true); $is_tax_enabled = in_array($tax_slug, $enabled_taxonomies, true); ?>
    - -
    -
    -

    - - - - - -

    -
    - -
    - -
    - -
    - - -
    -
    - - -
    - - -
    -
    -
    -