Install
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.zipAI 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 redirectexchange_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
- Backup your current plugin settings (if already installed)
- Deactivate and delete the old "AI Social Share" plugin
- Upload this entire
ai-social-share-fixedfolder to/wp-content/plugins/ - Activate the plugin
- 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
- Go to General tab
- Get API key from https://openrouter.ai/keys
- Enter API key and select your preferred AI model
- Save settings
Step 2: Connect Facebook
- Create a Facebook App at https://developers.facebook.com/apps
- Note your App ID and App Secret
- Go to Facebook tab in plugin
- Enter App ID and App Secret
- Add OAuth Redirect URI to your Facebook App (displayed in the plugin)
- Add your domain to App Domains in Facebook App Basic Settings
- Click "Connect to Facebook"
- Authorize and select your Facebook Page
Step 3: Configure Scheduler
- Go to Scheduler tab
- Set check interval (how often to check for new posts)
- Set posts per run (how many to share at once)
- Configure content filters if needed
- 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