=== JT Media Folders ===
Contributors: jtruax
Tags: media, folders, library, organization, gutenberg
Requires at least: 5.0
Tested up to: 6.9.4
Requires PHP: 7.4
Stable tag: 1.0.6
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A lightweight solution to add categorized folders to your WordPress Media Library. Works with bulk selection. Optimized for the Gutenberg editor.

== Description ==

= Features =

* **Folder Organization**: Create, edit, and delete media folders/categories
* **AJAX Filtering**: Filters media items using AJAX
* **Bulk Operations**: Assign multiple media items to folders using WordPress bulk selection (Grid + List view)
* **Made for Gutenberg**: Full integration with the Gutenberg editor (when inserting media into posts/pages)
* **Hierarchical Structure**: Support for nested folders (parent/child relationships)
* **Lightweight**: Plugin was developed with performance in mind
* **Non-intrusive UI**: Clean and simple user interface and controls that are mobile-friendly
* **100% free**: This plugin is free to use, no paywalls or annoying notices

= Creating Folders =

1. Go to Media > Library in your WordPress admin
2. Click the "Add Folder" button in the left sidebar
3. Enter a folder name and optional description
4. Optionally select a parent folder for hierarchical organization
5. Click "Save" to create the folder

= Organizing Media =

**Individual Assignment:**

* Click on any media item to edit it
* Select a folder from the "Folder" dropdown
* Save the changes

**Bulk Assignment (Works in both List and Grid views):**

*List View:*

1. Select multiple media items using checkboxes
2. Choose a folder from the dropdown in the sidebar's "Bulk Actions" section
3. Click "Assign Selected" to move all selected items to the chosen folder

*Grid View:*

1. Click on media items to select them (they'll show a blue border when selected)
2. Choose a folder from the dropdown in the sidebar's "Bulk Actions" section
3. Click "Assign Selected" to move all selected items to the chosen folder

= Managing Folders =

* **Edit**: Click the pencil icon (✏️) next to any folder name
* **Delete**: Click the trash icon (🗑️) next to any folder name
* **Smart Filter**: Click on any folder name to filter the media library by that folder
* **All Files**: Click on "All Files" to show all media regardless of folder assignment

= Requirements =

* WordPress 5.0 or higher
* PHP 7.4 or higher
* MySQL 5.6 or higher

= Security =

The plugin follows WordPress security best practices:

* Nonce verification for all AJAX requests
* Data sanitization and validation
* Capability checks for user permissions
* SQL injection prevention using $wpdb->prepare()

== Installation ==

1. Upload the `jt-media-folders` folder to your `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Navigate to Media > Library to start organizing your media files

= Main Media Library =

Access via **Media > Library** in WordPress admin for full folder management capabilities.

= Gutenberg Media Modal =

When inserting media into posts/pages, the plugin automatically adds a sidebar to the media modal for easy filtering and organization.

== Screenshots ==

1. Media Library with folder sidebar and filtering
2. Folder management interface
3. Gutenberg media modal with folder integration

== Changelog ==

= 1.0.6 =
* Fixed: "Add Folder" button content alignment on Media Library sidebar

= 1.0.5 =
* New feature added: Bulk-assign items from the Gutenberg Media Modal
* Added infinite scrolling for large libraries
* Added toggle collapse for Media Library page
* Allowed media files to be assigned multiple categories
* Security: harden AJAX auth, fix orphaned assignments, strip internal error details

= 1.0.4 =
* Fixes for the Gallery block
* Added ability to edit folder names in Gutenberg
* UI improvements

= 1.0.3 =
* Fixed issue when editing multiple folder names
* Updates to Gutenberg folder selection field
* Updates to search field

= 1.0.2 =
* New feature added: Click & drag folder reordering.
* Security hardening: Added category existence validation, prevented default category manipulation, and improved input sanitization for the folder reordering feature.

= 1.0.1 =
* AJAX filtering improvements
* UI fixes for Media Library while in List view
* Mobile improvements

= 1.0.0 =
* Initial release
* Folder creation, editing, and deletion
* Bulk media assignment
* Media library integration
* Hierarchical folder structure
* Modern, responsive interface

== Upgrade Notice ==

= 1.0.6 =
Fixes "Add Folder" button alignment in the Media Library sidebar on live sites.

= 1.0.5 =
Adds bulk-assign in the Gutenberg Media Modal, infinite scrolling for large libraries, multi-category assignment, and security hardening.
