=== Yatoon Social Feed ===
Contributors: yatoon, freemius
Tags: facebook, instagram, social feed, gallery, post grid
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Display your Facebook Page and Instagram Business photos and captions on your website in a clean, customizable grid - no plugin login flow required.

== Description ==

Yatoon Social Feed lets you show your Facebook Page photos and Instagram Business account photos side by side (or separately) anywhere on your WordPress site, using a simple shortcode.

Instead of a fragile one-click OAuth login (which frequently breaks as Meta changes its app review requirements), this plugin uses **long-lived access tokens** that you generate once via Meta's own tools and paste into the settings screen. This keeps the plugin lightweight and avoids requiring you to create and maintain your own Meta Developer App with special review permissions for basic photo display.

**Features**

* Connect a Facebook Page using a permanent Page Access Token
* Connect an Instagram Business account using an Instagram Access Token
* Automatic background sync (hourly, twice daily, or daily) - or sync manually with one click
* Independent grid settings for Facebook and Instagram (columns, rows, spacing)
* Optional profile header showing avatar, name, follower count, bio, and a Follow button - auto-synced from the connected accounts, no manual typing required
* Simple shortcode: `[yatoon_social_feed]`
* Lightweight: no external JavaScript SDKs loaded on your site, just your own photos

= Pro Version =

The free version displays a small "by Yatoon.com" credit beneath your post grid. [Upgrade to Pro](https://yatoon.com/social-feed/) to remove it.

**Shortcode usage**

    [yatoon_social_feed]
    [yatoon_social_feed platform="facebook"]
    [yatoon_social_feed platform="instagram"]
    [yatoon_social_feed platform="facebook" columns="3" rows="2"]

== Installation ==

1. Upload the plugin files to `/wp-content/plugins/yatoon-social-feed`, or install the plugin through the WordPress Plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Go to the **Yatoon Social Feed** menu item in your WordPress admin sidebar.
4. Follow the in-plugin setup guide to generate a Facebook Page Access Token and (optionally) an Instagram Access Token.
5. Paste the token(s) and click Verify & Save.
6. Click "Sync" to pull in your first batch of photos.
7. Add the `[yatoon_social_feed]` shortcode to any page or post.

== Frequently Asked Questions ==

= Do I need a Facebook Developer account? =

You need a free Meta Developer account to generate the access tokens this plugin uses, since Meta requires all third-party API access to go through an App ID and App Secret. The in-plugin setup guide walks you through this step by step. You do not need to submit your app for Meta's App Review for basic Page photo access - that's only required for advanced permissions.

= How long do the tokens last? =

A Facebook Page Access Token generated the way described in our setup guide does not expire under normal use. An Instagram Access Token currently lasts about 60 days; the plugin will continue working with the last-synced photos after expiry, and you can generate a fresh token in a couple of minutes using the same setup guide.

= Does this plugin load Facebook's or Instagram's JavaScript SDK on my site? =

No. All API calls happen server-side from your WordPress installation. Visitors to your site only see the photos themselves - nothing is loaded directly from Meta's servers in the visitor's browser except the image files.

= What data does this plugin store? =

The plugin stores your Facebook/Instagram access tokens and basic profile info (name, avatar URL, follower count, bio) in the WordPress options table, and a local cache of your synced photo metadata (image URL, caption, link, date) in a custom database table. No visitor data is collected or stored.

= What happens to my data if I delete the plugin? =

If you delete the plugin (not just deactivate it) from the Plugins screen, all of its stored options and its database table are automatically removed.

== Screenshots ==

1. Settings screen - connect your Facebook Page and Instagram account.
2. Profile header and display settings.
3. Example post grid output on the front end.

== External Services ==

This plugin connects to external APIs provided by Meta (Facebook/Instagram) to retrieve photos and profile information. These calls are made server-side from your WordPress installation - no Meta JavaScript SDK is loaded in visitors' browsers.

**Facebook Graph API**
Used to fetch your Facebook Page profile data (name, avatar, follower count, bio) and Page photos. Data is sent when you verify your token and during background sync.
- Service: Facebook / Meta Platforms, Inc.
- Endpoint: https://graph.facebook.com/
- Terms of Service: https://developers.facebook.com/terms/
- Privacy Policy: https://www.facebook.com/privacy/policy/

**Instagram Graph API**
Used to fetch your Instagram Business account profile data and media. Data is sent when you verify your token and during background sync.
- Service: Instagram / Meta Platforms, Inc.
- Endpoint: https://graph.instagram.com/
- Terms of Service: https://developers.facebook.com/terms/
- Privacy Policy: https://privacycenter.instagram.com/policy/

**Meta CDN (image serving)**
After sync, your WordPress site displays photos using their original URLs hosted on Meta's content delivery network (e.g., `scontent-*.cdninstagram.com`, `scontent-*.fbcdn.net`). When a visitor's browser loads your page, it fetches these image files directly from Meta's servers. No personal visitor data is intentionally sent - this is a standard image request.
- Privacy Policy: https://www.facebook.com/privacy/policy/

No visitor data is collected or stored by this plugin. The only data transmitted to Meta's APIs is your access token (to authenticate requests) and API query parameters (e.g., requested fields, pagination limits).

== Changelog ==

= 1.0.6 =
* Added video support for both Facebook and Instagram. Videos show in the grid as a poster image with a play icon and play inline in the lightbox on click; video files are streamed directly from Meta's CDN rather than downloaded to your server.

= 1.0.5 =
* Added optional Masonry layout and popup lightbox for feed images.
* Simplified the admin settings screen with clearer sync health cards and advanced settings collapsed by default.
* Added simple layout controls while keeping detailed per-platform grid controls available under Advanced.
* Fixed a packaging issue that could cause "headers already sent" warnings on some hosts.
* Extended the existing Freemius after_uninstall cleanup to also remove cached images, so nothing is left behind when the plugin is deleted.
* Reduced redundant Facebook profile API calls during sync to lower the chance of hitting Meta rate limits.
* Hardened Instagram sync against occasional malformed/partial API responses.
* Added proactive admin warnings when a Facebook or Instagram token looks expired, instead of only surfacing errors after the fact.
* Added a simple sync lock so manual "Sync now" clicks and the scheduled auto-sync can never run concurrently.
* Validated the `platform` shortcode attribute against a known list instead of silently rendering an empty grid on a typo.
* Moved Live Preview next to Step 3's Display Settings and made it update instantly as you change layout, display mode, lightbox, link, gap - no need to save first.
* Widened the settings page and gave Live Preview more room, with compact profile-header styling so it doesn't look cramped in the sidebar.
* Added the missing Columns/Rows fields for the combined feed (previously only saved via a stray shortcode attribute) and made Live Preview mirror them exactly, so what you see matches what visitors actually get.
* Live Preview now scrolls both directions instead of squashing thumbnails, so it stays legible even with large grids like 6 columns x 6 rows.
* Removed the old empty placeholder "Facebook/Instagram Grid Preview" boxes under Advanced grid controls - the real photo-based Live Preview made them redundant.
* Fixed a bug where a temporary network/rate-limit hiccup during sync was misreported as "token expired." Sync now retries once automatically on a transient failure, and only shows a "regenerate your token" message when Meta's response unambiguously confirms the token itself is invalid.

= 1.0.4 =
* Added next auto-sync time and last auto-sync status to the settings screen.
* Added separate last-error diagnostics for Facebook and Instagram sync.
* Reschedule WP-Cron immediately when the auto-sync frequency changes.
* Improved Instagram API error reporting so failed requests are visible instead of looking like empty syncs.

= 1.0.3 =
* Updated Freemius SDK to 2.13.4.
* Split Facebook Page token and Instagram token setup into independent Step 1A / Step 1B flows.
* Facebook token removal no longer removes Instagram settings, and Instagram removal no longer touches Facebook settings.
* Added display modes for images only, text only, or images plus text/captions.
* Improved Facebook sync refresh and error handling so valid saved Page tokens are rechecked before sync.
* Moved Facebook and Instagram sync actions to one primary button per token section.
* Changed the admin menu page slug to avoid being captured by Yatoon Booking's admin shell.

= 1.0.2 =
* Updated Meta Graph API endpoints from v19.0 to v25.0.
* Improved Facebook photo sync fallback when the full images array is unavailable.
* Facebook photos are now cached locally during sync to prevent expired Meta CDN URLs from breaking the front-end grid.
* Added a configurable Meta API version setting for future Graph API version changes.

= 1.0.1 =
* Added optional Pro upgrade (removes the "by Yatoon.com" footer credit).
* Fixed Plugin URI to a valid URL.
* Bumped stable tag to match plugin version.

= 1.0.0 =
* Initial public release.
* Facebook Page photo sync via permanent Page Access Token.
* Instagram Business photo sync via Instagram Access Token.
* Independent grid layout settings per platform.
* Auto-synced profile header (avatar, name, followers, bio, follow button).
* Scheduled background sync with manual sync option.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
