WP Manifestindependent plugin directory
manifest / social / ai-social-share

AI Social Share

Automatically generates and shares WordPress posts to social media using OpenRouter AI (Facebook first).

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/mo-sawah/ai-social-share/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

AI Social Share - Modernized & Fixed Version

What's Fixed

1. Facebook OAuth URL Encoding Bug ✅

Problem: WordPress's add_query_arg() function doesn't properly URL-encode parameters that contain special characters (?, &). This caused Facebook OAuth to fail with "URL blocked" errors.

Fixed in: class-aiss-facebook.php

  • build_oauth_url() - Initial OAuth redirect
  • exchange_code_for_token() - Token exchange

Solution: Replaced add_query_arg() with http_build_query($params, '', '&', PHP_QUERY_RFC3986) which properly encodes all special characters according to RFC 3986 standards.

2. Disappearing Page Selector Bug ✅

Problem: After selecting a Facebook Page, the page selector disappeared and users couldn't see which page was connected.

Fixed in: class-aiss-admin.php

  • Now shows prominent connection status with page name and ID
  • Displays connection details in a beautiful card
  • Page selector only shows during initial setup
  • After connection, shows clear status with disconnect button

3. Modern UI Overhaul ✅

Completely redesigned the admin interface with:

  • Beautiful gradient headers
  • Modern card-based layout
  • Color-coded status indicators
  • Smooth animations
  • Better typography and spacing
  • Responsive design
  • Professional color scheme (purple/blue/green gradients)

Installation

  1. Backup your current plugin settings (if already installed)
  2. Deactivate and delete the old "AI Social Share" plugin
  3. Upload this entire ai-social-share-fixed folder to /wp-content/plugins/
  4. Activate the plugin
  5. Configure settings in WordPress Admin → Settings → AI Social Share

Features

  • ✅ Automatic Facebook posting with AI-generated content
  • ✅ OpenRouter AI integration (GPT-4, Claude, Gemini)
  • ✅ Customizable scheduling (every X minutes)
  • ✅ Content filters (categories/tags)
  • ✅ Manual sharing from post editor
  • ✅ Beautiful modern admin interface
  • ✅ Secure token encryption
  • ✅ Comprehensive status dashboard

Setup Guide

Step 1: Configure OpenRouter API

  1. Go to General tab
  2. Get API key from https://openrouter.ai/keys
  3. Enter API key and select your preferred AI model
  4. Save settings

Step 2: Connect Facebook

  1. Create a Facebook App at https://developers.facebook.com/apps
  2. Note your App ID and App Secret
  3. Go to Facebook tab in plugin
  4. Enter App ID and App Secret
  5. Add OAuth Redirect URI to your Facebook App (displayed in the plugin)
  6. Add your domain to App Domains in Facebook App Basic Settings
  7. Click "Connect to Facebook"
  8. Authorize and select your Facebook Page

Step 3: Configure Scheduler

  1. Go to Scheduler tab
  2. Set check interval (how often to check for new posts)
  3. Set posts per run (how many to share at once)
  4. Configure content filters if needed
  5. Save settings

Technical Improvements

Code Quality

  • ✅ Proper URL encoding throughout
  • ✅ Secure token storage with encryption
  • ✅ Input sanitization and validation
  • ✅ WordPress coding standards
  • ✅ Error handling and user feedback
  • ✅ Transient caching for OAuth flow

UI/UX

  • ✅ Inline CSS for consistency
  • ✅ No external dependencies
  • ✅ Smooth transitions and animations
  • ✅ Clear visual hierarchy
  • ✅ Responsive design
  • ✅ Accessible color contrast

Security

  • ✅ Capability checks on all actions
  • ✅ Nonce verification
  • ✅ Encrypted token storage
  • ✅ Sanitized inputs and outputs
  • ✅ CSRF protection

File Structure

ai-social-share-fixed/
├── ai-social-share.php          (Main plugin file)
├── readme.txt                    (WordPress.org readme)
├── uninstall.php                 (Cleanup on uninstall)
└── includes/
    ├── class-aiss-plugin.php     (Plugin initialization)
    ├── class-aiss-admin.php      (Admin interface - MODERNIZED)
    ├── class-aiss-facebook.php   (Facebook integration - FIXED)
    ├── class-aiss-openrouter.php (OpenRouter AI)
    ├── class-aiss-cron.php       (Scheduler)
    ├── class-aiss-metabox.php    (Post editor metabox)
    └── class-aiss-utils.php      (Utility functions)

Support

For issues or questions:

  • Review the Status tab in plugin settings
  • Check Facebook App settings match the displayed redirect URI
  • Ensure OpenRouter API key is valid
  • Verify WordPress cron is working (wp cron event list)

Version

Version: 1.0.1 (Fixed & Modernized) Author: Sawah Solutions License: GPLv2 or later


Changelog:

  • v1.0.1: Fixed OAuth URL encoding, modernized UI, fixed disappearing page selector
  • v1.0.0: Initial release