=== PostRSS Advanced Dashboard Integration ===
Tags: rss, automation, feed, publishing, dashboard
Requires at least: 5.0
Requires PHP: 7.4
Tested up to: 7.1
Stable tag: 2.1.13
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html

Connect your PostRSS (postrss.com) account, choose which posts, pages or other content this site should publish, and manage your automated social media targets — all from your WordPress dashboard.

== Description ==
This plugin adds a "PostRSS" menu to your WordPress dashboard with these pages:

* **Settings**: connect your PostRSS (postrss.com) account directly from your dashboard, so this site can manage your feeds on your behalf — with links to create an account or recover your password on postrss.com if you don't have one yet.
* **Feeds**: pick which content this site should publish — Posts (optionally filtered by category), Pages, or any other public content type your theme or plugins register — and which of your connected PostRSS destinations (Facebook, LinkedIn, X/Twitter, Pinterest, VK…) it should post to, with full control over how often to check, the daily posting window, publishing order, max posts per run, and post text. Clicking "Add" automatically creates the matching target on PostRSS, pointed at a feed of your own site's content filtered to your selection. Click any existing target to view its status, add any number of additional sources to it, edit or remove any one of them, pause or resume the whole target, jump to its posting report, or remove it. You can also connect a brand new destination account from this page.
* **Account**: your PostRSS profile and subscription usage (plan, tasks used, targets, expiry) at a glance, plus the full list of available plans with Upgrade!/Downgrade! buttons when you're ready to change plans.
* **Statistics**: this month's and past months' posting activity per destination type.
* **Orders**: your PostRSS billing history.
* **Affiliate**: your PostRSS affiliate stats, if you're enrolled.
* **Help**: a link to the official PostRSS setup documentation.

PostRSS is a tool that saves you time by managing your publishing source and targeting accounts automatically.

== Installation ==
1. Upload the plugin folders to the `/wp-content/plugins/` directory, or install the plugin through the WordPress plugins screen directly.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Navigate to PostRSS -> Settings to connect your PostRSS account.
4. Navigate to PostRSS -> Feeds to choose what to publish and where.

== Frequently Asked Questions ==
= Is my PostRSS password stored by this plugin? =
No. Your email and password are sent directly to postrss.com over HTTPS to start a session, the same as logging in on postrss.com itself. Only the resulting session — not your password — is stored, so this site can manage feeds and targets on your behalf until you click Disconnect.

= What does the "Feeds" page actually send to PostRSS? =
When you click "Add", the plugin builds a normal WordPress RSS feed URL for the content type (and, for Posts, categories) you selected — the same kind of feed WordPress already exposes publicly for that content — and asks PostRSS to create a target that watches that feed. No content is uploaded ahead of time; PostRSS simply polls the feed URL like any other RSS source.

= Does this plugin affect my website loading speed? =
No. The plugin only adds admin dashboard pages and a single extra RSS feed endpoint that's only requested when PostRSS (or you) actually load it. Public front-end visitors do not load any of this code.

== Screenshots ==
1. The main PostRSS advanced integration settings dashboard interface.
2. The Feeds page: choose what to publish and where.

== External services ==
This plugin connects to the PostRSS (postrss.com) service to manage your RSS publishing feeds and target accounts. All requests below are made server-side by your WordPress site, to https://app.postrss.com.

* **Settings page login**: the email and password you enter are sent directly to `https://app.postrss.com/login_check` to start a session. Only the resulting session cookie is stored in your WordPress database (in an option, not shown to site visitors) — your password itself is never stored. You can end the session at any time with the "Disconnect" button, which also calls `https://app.postrss.com/logout`. The "Create one on postrss.com" and "Forgot your password?" links simply open `https://app.postrss.com/register` and `https://app.postrss.com/login` in a new browser tab — no data is sent by the plugin itself for either.
* **Feeds page**: once connected, the plugin calls PostRSS's `/rest/*` endpoints to list your connected destination accounts (Facebook, LinkedIn, X/Twitter, Pinterest, VK) and your existing feeds (`GET`), to create a new target (`POST /rest/feeds`) or update one (`POST /rest/feeds/{id}`) with the content type/categories/schedule you selected, and to remove a target you created (`DELETE /rest/feeds/{id}`). The "Connect a new destination" links open `https://app.postrss.com/{platform}/authorize` in a new browser tab, where you authorize the connection directly with PostRSS. A target's Report and its item-level detail are fetched server-side from `https://app.postrss.com/feeds/{id}/report` and the linked detail page, and rendered inside your dashboard.
* **Content source**: a new target you create is pointed at this site's own WordPress RSS feed (e.g. `yoursite.com/feed/postrss-src/?prss_pt=post`), filtered to the content type/categories you picked — the same publicly-available content WordPress's normal feeds already expose, not a separate data upload.
* **Account, Statistics, Orders and Affiliate pages**: fetched server-side, read-only, from `https://app.postrss.com/profile/`, `/subscription`, `/statistics`, `/orders` and `/affiliate` respectively, using the same session. The Account page's "Plans" list is scraped from the same `/subscription` page; its Upgrade!/Downgrade! buttons open `https://app.postrss.com/orders/create/{id}` in a new tab, where you complete payment directly with PostRSS.
* **Help page**: the "View setup guide" link opens `https://postrss.com/how-to-setup-postrss/` in a new tab.

PostRSS is provided by PostRSS: [Terms of Service](https://postrss.com/terms), [Privacy Policy](https://postrss.com/privacy).

== Changelog ==
= 2.1.13 =
* A target can now watch several sources at once, matching the real app's "Sources +" button — the Feeds page's target detail view now lists every source with its own Edit/Remove, plus an "Add another source" form, instead of assuming one source per target.

= 2.1.12 =
* Fixed "Visit plugin site" (in the Plugins list) pointing at postrss.com instead of this plugin's own WordPress.org page.
* Settings page now links to "Create one on postrss.com" and "Forgot your password?" next to the login form — both were missing, so there was no way to register or recover a password without leaving to search for it.

= 2.1.11 =
* Account page now shows the actual available plans (name, price, key benefits) below your current subscription, each with an Upgrade!/Downgrade! button — matching the real "Plans" grid on postrss.com. Since payment itself has to happen there, the button takes you straight to that plan's order page instead of leaving you hunting for how to subscribe.

= 2.1.10 =
* "Post to" is now a Type dropdown plus a second dropdown scoped to that type's connected accounts (matching the real app's own Target settings layout), instead of one radio button per connected account. "Publish as" appears as a third dropdown when relevant.

= 2.1.9 =
* Fixed the Timezone display linking to an authenticated postrss.com page that redirected away when not already logged in there in your browser — it's plain text now.

= 2.1.8 =
* "Publish as" is now also editable on an existing target's detail page (not just when first adding it).
* "Timezone" is now shown next to the Exact-times picker, matching the real app (scraped from your account, cached briefly).

= 2.1.7 =
* Time settings: "Exact times" mode is now available alongside "Frequency" — pick specific times of day (and optionally a weekday) to check for new content, matching the real app's Time settings tab.
* "Publish as" is now a visible choice when adding a Facebook Page or VK Page target with a linked personal account, instead of always defaulting silently to the page itself.
* Existing targets list: added explicit "Edit" and "Pause"/"Resume" buttons (Pause/Resume no longer touches the source's saved schedule).

= 2.1.6 =
* Fixed "Server error" when adding a source to a just-created target: confirmed via a captured real request that after the target is first saved, PostRSS assigns it server-side ids (and, for Facebook/VK Page, ids on its nested "publisher") that must be resent on the next save — the plugin was rebuilding the target from scratch instead of reusing what PostRSS had just returned. Update requests also now include "id" in the body, matching the real app exactly.

= 2.1.5 =
* Error messages now include a raw response snippet from PostRSS alongside any parsed message, even when PostRSS's own message is generic (e.g. "Server error") — needed to diagnose failures the API itself doesn't explain in detail.

= 2.1.4 =
* Fixed Facebook Page and VK Page targets specifically still failing with "Invalid data" after 2.1.3 — these two types have a required "Publish as" choice (post as the page/group itself, or as the linked personal account) in the real app that was missing from the request; now defaults to "as the page itself".

= 2.1.3 =
* Target and source are now saved as two separate update calls after the target is created (matching the real app's own editTarget()/createSource() flow exactly), instead of one combined update — a combined update was itself rejected the same way a populated create was.
* Fixed the plugin's own version constant being stuck at 2.0.0, which could leave the admin CSS/JS served from a stale browser cache across updates.

= 2.1.2 =
* Posts (with or without a category filter) are now sourced from WordPress's own native feed (`/feed/`, or `/category/{slug}/feed/` for a single category) instead of this plugin's custom endpoint — a more familiar, directly-recognizable URL. Pages and other custom post types, which have no native WordPress feed, still use the plugin's own feed endpoint.

= 2.1.1 =
* Fixed "Add" failing with "Invalid data" for every destination type: target creation now matches the real app exactly — an empty target/sources shell is created first, then updated with the real destination and source, instead of sending both in one request (which the API rejects).
* Fixed "Maximum posts per update" always being sent as unset — it's a required field on the real API with no "unlimited" value; the plugin now sends "System maximum" or a specific count, matching the real dropdown.
* "Post text" options now match the real API exactly (nine formats, not two — the previous "custom" value was never valid).
* "Order" gained "Randomly with duplicates", and frequency options now match the exact list the real app offers.

= 2.1.0 =
* Feeds page: full control over each source's schedule — how often to check, daily posting window, publishing order, max posts per run, post text, "post items from" date, and additional query parameters — on both new and existing targets.
* Click a target to view and edit it (status, schedule), open its Report, or remove it, instead of only seeing it in a list.
* Report (and its item-level "View items" detail) now loads inside your dashboard using the plugin's own session, instead of opening postrss.com in your browser (which had no session of its own).
* New Account, Statistics, Orders and Affiliate pages, matching the rest of the PostRSS dashboard.
* More detailed error messages when PostRSS rejects a request, instead of a bare HTTP status code.

= 2.0.0 =
* New "Feeds" page: pick which Posts (by category), Pages, or other public content type to publish, and which connected PostRSS destination to post it to.
* Adding a content source now automatically creates the matching target on PostRSS, pointed at a filtered WordPress RSS feed.
* Connect your PostRSS account directly from the Settings page (session-based; your password is never stored).
* Connect new destination accounts (Facebook, LinkedIn, X/Twitter, Pinterest, VK) and remove targets created from this site, without leaving your dashboard.

= 1.1.1 =
* Replaced dashboard iframes with user-initiated links to PostRSS, for security and compliance with WordPress.org guidelines.
* Fixed malformed URLs in the plugin description.
* Adjusted admin menu position.

= 1.1.0 =
* Main production release.

== Upgrade Notice ==
= 2.1.13 =
Targets can now have multiple sources, matching the real app's "Sources +" button — previously the plugin only ever managed a single source per target.

= 2.1.12 =
Fixes "Visit plugin site" linking off-site instead of to this plugin's WordPress.org page, and adds missing "Register" / "Forgot password?" links on the Settings page.

= 2.1.11 =
Account page now shows available plans with direct Upgrade!/Downgrade! buttons — previously there was no visible way to subscribe.

= 2.1.10 =
"Post to" is now a Type + account dropdown pair like the real app, instead of a radio-button list.

= 2.1.9 =
Fixes the Timezone display redirecting to postrss.com's main site instead of just showing text.

= 2.1.8 =
"Publish as" is now editable on existing targets too, and the account's timezone shows next to Exact times.

= 2.1.7 =
Adds Exact-time scheduling, a visible "Publish as" choice for Facebook/VK Page targets, and Edit/Pause/Resume buttons on the targets list.

= 2.1.6 =
Fixes "Server error" when adding a source to a target — the plugin now reuses the server-assigned ids PostRSS returns after saving the target, instead of resending a fresh copy.

= 2.1.5 =
Error messages now show more raw detail from PostRSS, to help diagnose failures it only describes generically.

= 2.1.4 =
Fixes Facebook Page / VK Page targets still failing after 2.1.3 — a required "Publish as" field was missing.

= 2.1.3 =
Target and source are now saved as two separate steps matching the real app exactly — fixes "Invalid data" still occurring on Add in some cases.

= 2.1.2 =
Posts now use WordPress's own native /feed/ (or per-category feed) URL instead of a plugin-specific one.

= 2.1.1 =
Fixes "Add" failing with "Invalid data" for every destination — target creation now matches the real app's own two-step request exactly.

= 2.1.0 =
Feeds now have full schedule control and an edit view, Report loads in-dashboard, and Account/Statistics/Orders/Affiliate pages were added.
