=== Photoledger ===
Contributors: ektadev
Tags: media library, copyright, license, image licensing, dmca
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Require license proof for every image uploaded to your Media Library — source, download date, and a license key or document.

== Description ==

Photoledger makes sure every image uploaded to your WordPress Media Library has a paper trail: where it came from, when it was downloaded, and proof that you were licensed to use it. If a photographer, stock agency, or competitor ever comes after you over an image, you have the answer in seconds instead of digging through old emails and downloads folders.

**How it works**

The moment someone uploads an image through Media → Add New, they're asked for:

* **Source of Image** — where it came from (Shutterstock, Adobe Stock, a client, etc.)
* **Download Date**
* At least one of: **Account ID**, **License Key**, or an uploaded **License Document** (the actual invoice/receipt/license PDF)

An image cannot be uploaded without this information — the plugin blocks uploads from the classic uploader, the block editor, and the REST API alike, so there's no way around it.

**Optional "Advanced License Details"**

For anyone who wants to track more, an optional panel captures:

* License Type (Royalty-Free, Rights-Managed, Editorial Use Only, Creative Commons, Extended License, Other)
* License Expiry Date (with an optional time, for licenses that expire at a specific moment)
* Attribution Text
* Photographer / Artist
* Cost Paid
* Invoice / Purchase Number
* Internal Notes

**Batch uploads**

Dropping several images at once into the Media Library? One shared form covers the whole batch — fill it once, and every image in that drop gets the same license details.

**Fixing missing details later**

Every image's Edit screen has an editable "License Details" panel in the sidebar — nothing is locked in at upload time. Missing a License Key you found later? Add it any time, including uploading or replacing the proof document.

**See everything at a glance**

* A **License** column and filter dropdown right in the Media Library list, showing Licensed / Missing / Expiring / Expired for every image.
* A dedicated **License Manager** dashboard with stat cards, a searchable and filterable table (by status, source, or download date), and one-click CSV export (formatted so Excel doesn't mangle long ID numbers or dates).
* Automatic **daily email reminders** for anything expiring soon or already expired.

**Settings**

* Choose which of the Advanced fields are required.
* Provide a fixed list of allowed "Source of Image" values, or leave it free text.
* Set the maximum license-document file size and allowed file types.
* Configure the expiry reminder email address and how many days ahead to warn.
* Choose whether License Expiry Date captures a date only, or a date and time.

License documents (the actual proof files) are kept out of the normal Media Library grid and picker — they're stored as attachments linked to the image they belong to, not shown as if they were photos themselves.

== Installation ==

1. Upload the `photoledger` folder to `/wp-content/plugins/`, or install the ZIP directly via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin through the **Plugins** menu in WordPress.
3. A new **License Manager** menu appears in the WordPress admin sidebar.
4. Visit **License Manager → Settings** to:
   * choose which extra fields (if any) should be required,
   * optionally set a fixed list of image sources,
   * set the maximum license-document size and allowed file types,
   * turn on expiry reminder emails and set the email address / warning window.
5. From now on, every image uploaded through **Media → Add New** (or the Media Library's "Add Media File") will ask for its license details before the upload completes.

No database setup or configuration is required beyond Settings — the plugin works immediately after activation.

== Frequently Asked Questions ==

= Can someone upload an image without filling in the license details? =

No. Uploads are blocked at the server level for the classic uploader, the block editor's image blocks, and the REST API — not just hidden in the UI. There's no route around it for a logged-in user with upload permission.

= What happens to images that were uploaded before I installed the plugin? =

They're shown as "Missing" in the License column and dashboard until you open each one's Edit screen and fill in its details — the plugin doesn't retroactively invent data for images it didn't see uploaded.

= Where are the license documents (PDFs/receipts) stored? =

As regular WordPress attachments, linked to the image they belong to, but hidden from the normal Media Library grid and the "Insert Media" picker so they never get mistaken for a photo.

= Does this work with ACF (Advanced Custom Fields)? =

If ACF is active and has field groups using the same field names, the plugin's own values take priority and ACF's editing controls for those fields are made read-only on the attachment edit screen, to avoid two different places trying to control the same value.

= Can I require the Advanced fields, or is everything except the basics optional? =

Any of the Advanced fields can be marked required from License Manager → Settings. The four core fields (Source, Download Date, and one of Account ID/License Key/Document) are always required — that's the whole point of the plugin.

== Screenshots ==

1. The upload wizard — Source, Download Date and license identifiers requested right inside Media → Add New.
2. The optional Advanced License Details panel — License Type, Expiry Date & Time, Attribution and more.
3. The Media Library "License" status column and filter dropdown.
4. The License Manager dashboard — stat cards, filters and the license table.
5. CSV export opened in Excel, correctly formatted.
6. The editable License Details panel on an image's Edit screen.
7. Batch upload — one shared form applied to several images dropped at once.
8. The Settings page.

== Changelog ==

= 1.0.0 =
* Initial release (previously distributed under the name "Image Copyright Guard" prior to its first public listing). All internal functions, classes, options, meta keys, nonces, and script/style handles use the `ektailr_` / `EKTAILR_` prefix; front-end assets are loaded via the standard WordPress `wp_enqueue_script()` / `wp_enqueue_style()` APIs rather than printed inline.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
