=== R2 Media Folders ===
Contributors: rise2studio
Tags: media library, folders, media folders, media categories, attachments
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
Stable tag: 1.3.2
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Organize the WordPress Media Library into nestable folders. A lightweight, dependency-free alternative to FileBird.

== Description ==

R2 Media Folders adds a folder tree to your Media Library so you can organize thousands of files into nestable folders.

* Folder tree sidebar in both grid and list views, with All Files and Unsorted virtual folders and live counts.
* Create, rename, delete and nest folders.
* Drag files (single or multi-select) into folders; bulk move supported.
* Drag folders to reorder and re-nest, with a saved manual order.
* Filter the library by folder — live in the grid, by URL in the list view.
* Full folder panel inside every media modal (classic editor "Add Media", ACF fields, Featured Image, block editor picker): folder tree with counts, search, and inline New Folder creation, plus a synced toolbar dropdown. Uploads made inside the modal land in the selected folder.
* Optional per-user private folders.
* One-click FileBird importer (idempotent) — migrate folders and file assignments, then deactivate FileBird.
* Settings: per-user folders, default order, and opt-in delete-on-uninstall.

Folders are stored as a native WordPress taxonomy, so they survive exports and are removed cleanly on uninstall. Your files are never deleted by this plugin.

== Installation ==

1. Upload the `r2-media-folders` folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins screen.
3. Open Media → Library and use the folder tree on the left. Configure options under Settings → Media Folders.

== Frequently Asked Questions ==

= Does it move or delete my files? =
No. It only organizes files into folders (a taxonomy assignment). Your media files are never moved on disk or deleted.

= What happens if I delete a folder? =
The files inside it move to Unsorted and any subfolders move up one level. Nothing is lost.

= Is this related to FileBird? =
No. It is an original, independent plugin built by RISE2 Studio. FileBird was only used as a feature reference.

== Changelog ==

= 1.3.2 =
* Changed: asset cache-busting is now automatic — script/style URLs carry the plugin version plus each file's modification time, so browsers can never keep serving a stale copy of the folder JS/CSS after an update (previously that could show wrong folder-filter values until a hard refresh).

= 1.3.1 =
* Fixed: uploading into a selected folder inside the media modal updated the count but the file didn't appear in the grid until a page refresh — filtered wp.media collections don't receive finished uploads, so the view now re-queries when an upload batch completes (verified live).
* Fixed: deleting an attachment from the modal left the folder counts stale until refresh — the tree now refreshes when an attachment is destroyed.
* Fixed: the folder filter in the modal toolbar was mis-placed and label-less, pushing the toolbar into a scrollbar. It now ships the same label-above-select shape as the core type/date filters, explicitly placed in the toolbar grid.

= 1.3.0 =
* Added: FileBird-style folder panel inside the media modal — folder tree with counts, expand/collapse, live search and inline New Folder creation, shown in a left column in every wp.media modal (classic editor, ACF image/gallery fields, Featured Image, block editor picker). Selecting a folder filters the grid; the toolbar dropdown stays as a synced fallback; uploads inside the modal land in the selected folder. On desktop the panel joins core's classic left menu column (select frames like ACF/Featured Image get the column un-hidden at core's own metrics); on mobile it lives inside core's dropdown menu with its own scrolling.

= 1.2.3 =
* Fixed: the folder sidebar didn't appear on a bare /wp-admin/upload.php (it showed only with an explicit ?mode=grid or ?mode=list in the URL). The plugin assumed grid whenever ?mode= was absent, but WordPress renders the user's saved view preference there; the mode is now resolved exactly like core does it.

= 1.2.2 =
* Fixed: in the Media Library **list view**, the whole file table rendered *below* the folder sidebar instead of beside it (grid view was fine). WordPress core styles `.tablenav { clear: both }`, which was clearing our floated sidebar; the list anchor now establishes its own block formatting context so the clear no longer applies to it.

= 1.2.1 =
* Fixed: in the media modal (e.g. picking a Featured Image) the folder filter wrapped onto a second row and slipped into the scrollable attachments area. Widened the toolbar's secondary grid so the type, date and folder filters stay inline. CSS-only, scoped so no other media toolbar is affected.

= 1.2.0 =
* Added: self-hosted update support — a "Check for updates" link on the Plugins page and integration with Dashboard → Updates, served from plugins.rise2.studio.
* Added: a "Settings" shortcut link on the Plugins page row.
* Changed: renamed the admin menu item under Settings from "Media Folders" to "R2 Media Folders".

= 1.1.1 =
* Fixed: search box magnifier icon no longer overlaps the placeholder text.
* Changed: made the folder taxonomy explicitly non-public (publicly_queryable=false) and added belt-and-suspenders sitemap exclusions (WP core + Yoast). It was already excluded from sitemaps/SEO plugins; this guarantees it stays that way.

= 1.1.0 =
* Added: inline create/rename in the tree (folder field + Cancel/Save, Enter/Esc) instead of a browser prompt.
* Added: folder search box that live-filters the tree by name.
* Added: a first-activation prompt offering to import FileBird folders when FileBird is detected.

= 1.0.4 =
* Security: turned off REST exposure for the media_folder taxonomy (it was enumerable, incl. anonymously, via /wp/v2/media-folder). Hardened reorder() to enforce manage capability and visibility-gated the ?r2mf_folder= filter. All from a pre-production security review.

= 1.0.3 =
* Changed: per-file upload progress (FileBird-style floating panel) — each file shows its own progress bar and status, with a header count, instead of one overall indicator.

= 1.0.2 =
* Added: upload progress indicator, and uploaded files now appear in the current folder immediately (the grid re-queries on upload completion) — no page refresh needed.

= 1.0.1 =
* Fixed: clicking a folder did nothing after opening and closing an image in the grid (wp.media left the grid stuck on the closed attachment view). The sidebar no longer re-parents the media frame, and folder filtering now recovers reliably.
* Fixed: uploading while inside a folder now puts the file in that folder (and shows the normal upload progress), instead of landing in All Files.

= 1.0.0 =
* Initial release: folder tree, nesting, drag-and-drop file moves, bulk move, drag-to-reorder/nest, library + media-modal filtering, per-user folders, settings, clean uninstall.
