=== FileDeck – Document Library & Download Manager ===
Contributors: josephlines
Tags: document library, download manager, file manager, document management, downloads
Requires at least: 6.1
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 2.13.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Searchable, sortable document library: table, grid, or folder layouts with instant search, filters, download tracking, and a Gutenberg block.

== Description ==

FileDeck is a WordPress document library plugin that turns file collections into fast, searchable libraries with table, grid and folder layouts. List policies, guides, minutes, forms, resources, or any downloadable files — with instant search that filters as you type — and have a professional document library on your site in minutes.

**See it in action:** try the [live demo](https://www.getfiledeck.com/demo/) — a real 66-document library, no signup — or read the [documentation](https://www.getfiledeck.com/docs/).

**A free version that's actually usable.** Every layout, every filter, and the Gutenberg block are free, and you can list as many documents as you like. Nothing essential is locked away just to force an upgrade.

= Free features =

* **Three layouts** – searchable table, responsive card grid, or collapsible folders by category
* **Instant search** – filters as you type, no page reloads
* **Filter dropdowns** – categories and tags, plus click-a-category filtering
* **Sortable columns** – title, date, size, type, downloads, and more
* **Unlimited documents** – no cap; search scales automatically as your library grows
* **Download tracking** – per-document download counts
* **Force download or open in browser** – choose per document whether the button saves the file or displays it in the browser, instead of leaving it to each visitor's browser defaults
* **Gutenberg block + shortcode + Elementor widget** – native block with live preview, a `[filedeck]` shortcode, and a "FileDeck Library" Elementor widget — all with the same layout, filter and column options
* **⌘K command palette** – site-wide quick-search overlay that jumps straight to any document
* **QR codes** – generate a printable QR for any document (offline, nothing leaves your site) for noticeboards and posters
* **Shareable filtered views** – search/filter state lives in the URL with a one-click “copy link”; hover previews show a thumbnail and file details
* **External links** – list documents hosted on Google Drive, Dropbox, SharePoint, or any URL
* **Custom fields & taxonomies** – add any post meta (cf:field) or taxonomy (tax:slug) as a column
* **Document previews** – lightbox preview for PDFs and images, and featured images open in a lightbox from the image column
* **Single document pages** – a clean page with file details and a download button
* **Standalone search & links** – `[filedeck_search]`, `[filedeck_login]`, and `[filedeck_download]` shortcodes
* **Styling options** – accent color, link styles, custom download-button text, custom empty message, page numbers or load-more, single-row truncation
* **Any file type** – PDF, Word, Excel, PowerPoint, images, audio, video, and more
* **Lightweight** – no jQuery on the frontend; assets load only where a library appears
* **Accessible** – keyboard-sortable columns, ARIA labels, screen-reader friendly

= FileDeck Pro =

Upgrade for the features organizations need — from $59/year, and your renewal never increases:

* **Full-text search** – search inside your PDFs, Office documents and text files, not just their titles; extraction runs on your own server, so documents never leave your site
* **Scanned-document OCR (optional)** – make scanned/image-only PDFs searchable too, via the opt-in FileDeck OCR service; off by default, and files are processed and immediately discarded
* **Access control & protected files** – restrict categories by role or password and set per-document visibility; restricted files are moved to a deny-all directory and served via signed, 15-minute-expiring download links, so direct file URLs stop working (automatic on Apache; nginx needs one rule)
* **Client areas** – assign users to a category and it becomes their private portal: a `[filedeck_my_documents]` page shows each client only their spaces, uploads land in your moderation queue, and assigned users are emailed when you publish new documents for them
* **Office & media previews** – preview Word, Excel and PowerPoint (via the Office viewer) plus audio and video, on top of the free PDF/image preview
* **Automatic PDF thumbnails** – grid and image views show a real first-page preview of each PDF, rendered on your own server
* **File-type & folder icons** – download buttons show a file-type icon (PDF, Word, Excel, PowerPoint, archive, image), and each category can display its own folder icon in the folder layout, from a built-in set (no uploads)
* **Download notifications** – an email and/or JSON webhook for every download (single or zipped) — watch a sensitive document, or pipe download events into Slack, Zapier or Make
* **Download quotas** – daily download limits per user role, and for logged-out visitors by IP; each file in a zip counts, and signed share links stay exempt
* **Cloud storage** – browse and attach files from Amazon S3, Dropbox, Google Drive and OneDrive, with a scheduled one-way pull that imports new files automatically
* **Multi-select zip** – let visitors select documents and download them as a single archive
* **Front-end submission & editing** – let visitors upload documents (one or many at once) through a `[filedeck_submit]` form with moderation, see their own documents with `[filedeck_my_submissions]`, and edit them with `[filedeck_edit]`; optional Cloudflare Turnstile anti-spam, blocks for all three
* **Bulk add & CSV import** – create documents from Media Library files in bulk, or import a whole library from CSV
* **Custom fields & filtering** – define your own document fields (department, policy number, date, owner…), show them as sortable columns, and let visitors filter by them with faceted counts and date/number ranges; CSV and ACF friendly
* **Version history** – replaced files are archived automatically and can be restored
* **Supersede & evergreen links** – mark a document replaced by a newer one; a `/d/{slug}` link (and its QR code) always resolves to the current version
* **Review cycles** – put documents or categories on a review schedule; documents due for review are flagged, with a reminder digest
* **Approval gate** – an optional submit-for-review, approve-and-publish workflow on the document editor
* **Change subscriptions** – visitors subscribe (double opt-in) to a category or the whole library and get an email digest of new and updated documents
* **Library health monitor** – a weekly scan for missing files, dead external links and never-downloaded orphans, with an email digest
* **File integrity & SEO schema** – a SHA-256 checksum per file, shown on the document page, plus DigitalDocument structured data for search engines
* **GDPR toolkit** – activity-log retention, optional IP anonymisation, and one-click export/erase through WordPress' own privacy tools
* **Public changelog** – a `[filedeck_changelog]` shortcode publishing what changed in your library
* **Auto-expiry** – documents drop out of libraries after their expiry date
* **Lead capture** – require a name and email before download, with CSV export and an optional webhook (Zapier/CRM/your endpoint)
* **Activity log & audit trail** – record views, searches and downloads (who / when / what), with per-document access history, a content-gap report of searches that found nothing (with one-click document creation), and CSV export. On the AI plan, the log also captures Ask questions — including the ones it couldn't answer — in a dedicated AI Questions view
* **Analytics dashboard** – downloads, views and searches at a glance, with a downloads-over-time chart, your most-downloaded documents and top searches over 30 days to all time, and CSV export
* **Google Analytics 4 (optional)** – send document downloads, searches and previews to your own GA4 as standard events (file_download, search, select_content); off by default, and no data goes to FileDeck
* **CSV export** – export your whole document library to CSV for backups or bulk edits

Learn more at https://www.getfiledeck.com/pricing/

= Quick start =

1. Install and activate. FileDeck creates a “Document Library” page automatically.
2. Go to **Documents → Add New**, add a title, and attach a file (or paste an external URL).
3. Done — the document appears in your library instantly.

Use the **Document Library block** or the `[filedeck]` shortcode to place libraries anywhere:

`[filedeck layout="grid" category="policies" columns="title,excerpt,size,link" per_page="20"]`

= Shortcode options =

* `layout` – table, grid, or folders
* `columns` – comma-separated: id, image, title, excerpt, content, categories, tags, date, modified, author, size, type, filename, downloads, preview, link
* `category` – limit to category slugs (comma-separated)
* `per_page` – documents per page
* `sort_by` – title, date, modified, menu_order
* `sort_order` – asc or desc
* `link_style` – button, button_icon, icon, text
* `dl_text` – custom text for the download button/link (default "Download")
* `image_lightbox` – set to 0 to stop featured images opening in a lightbox
* `wrap` – set to 0 to keep every document on a single truncated row
* `scroll_offset` – pixel offset for pagination jumps, for themes with a sticky header

== Installation ==

1. Upload the plugin to `wp-content/plugins/filedeck`, or install it from Plugins → Add New in your WordPress admin.
2. Activate the plugin. A **Document Library** page is created automatically.
3. Go to **Documents** to add your files (from the Media Library or an external URL), and organize them with categories and tags.
4. Add the **Document Library** block to any page or post — or use the `[filedeck]` shortcode — to display your library.
5. Adjust layouts, columns, and styling under **Documents → Settings**.

== External services ==

This plugin can connect to these external services, all only with your opt-in:

**Freemius** — FileDeck uses Freemius to deliver plugin updates, and (for Pro customers) to activate licenses. On activation you are asked to opt in; if you decline, no data is sent and only anonymous update checks are made. If you opt in, Freemius receives basic environment data (site URL, WordPress/PHP versions, active theme/plugins) to power update delivery and diagnostics. This happens when you activate the plugin, opt in, activate a license, or check for updates.
Freemius terms: https://freemius.com/terms/ — privacy policy: https://freemius.com/privacy/

**FileDeck usage ping** — only if you opted in to usage tracking above (and never otherwise), FileDeck sends a small anonymous ping to `https://in.getfiledeck.com/telemetry` once a week to guide the product roadmap. It contains only the plugin/PHP/WordPress versions, the plan tier, a bucketed document count (e.g. "11–50"), and a handful of on/off feature flags (search index, OCR, AI mode, subscriptions). It never includes document contents, file names, URLs, emails, IP-based profiles, or any personal data. Declining or opting out of Freemius tracking disables it completely, and developers can switch it off with the `filedeck_telemetry_enabled` filter.
FileDeck privacy policy: https://www.getfiledeck.com/privacy/

**Cloud storage (Pro, optional)** — if you connect a cloud provider under Documents → Cloud storage, FileDeck contacts that provider's API using credentials you supply, only to list folders and fetch files you choose. Amazon S3 (`*.amazonaws.com`), Dropbox (`api.dropboxapi.com`, OAuth via `dropbox.com`), Google Drive (`googleapis.com`, OAuth via `accounts.google.com`), and Microsoft OneDrive (`graph.microsoft.com`, OAuth via `login.microsoftonline.com`). Nothing is sent to these services unless you set up a connection.
Amazon S3 terms: https://aws.amazon.com/service-terms/ — Dropbox: https://www.dropbox.com/terms — Google: https://policies.google.com/terms — Microsoft: https://www.microsoft.com/servicesagreement

The optional Pro **AI features** (semantic search and Ask this library) are not part of this free plugin. If you upgrade and enable them with your own API key, the document text you choose to index is sent to the AI provider you pick (OpenAI, Anthropic, or Voyage) to create embeddings and answers. They are off by default and never active in the free version.

== Frequently Asked Questions ==

= Is there a document limit? =

No. The frontend automatically handles large libraries: small libraries get a zero-round-trip inline search index; larger ones paginate efficiently.

= Can I link to files hosted elsewhere? =

Yes — each document can use an uploaded file or an external URL (Google Drive, Dropbox, SharePoint, S3, YouTube, etc.).

= Does it track downloads? =

Yes, every document shows a running download count (visible in the admin list and optionally as a frontend column).

= Does it work with my theme? =

FileDeck uses minimal, namespaced styles designed to inherit your theme's typography, and works with any properly-coded theme.

= I'm on nginx — how do I protect restricted files? =

FileDeck moves restricted documents' files into `wp-content/uploads/filedeck-protected/` and drops in an `.htaccess` deny rule. Apache honours that automatically. nginx ignores `.htaccess`, so add one location block to your server config and reload nginx:

`location ^~ /wp-content/uploads/filedeck-protected/ { deny all; return 403; }`

Until that rule is in place, authorised downloads still work (they are streamed through FileDeck), but the raw files in that folder remain directly reachable. On Apache (and most managed WordPress hosts), no action is needed.

== Screenshots ==

1. Searchable document table with instant search and category filter
2. Grid layout with file type badges
3. Drag-and-drop bulk upload — drop files and each becomes a document
4. Settings screen

== Changelog ==

= 2.13.0 =
* Added: featured images in the image column now open in a lightbox (free; turn off per library with `image_lightbox="0"`).
* Added: customizable download button text — a new "Download link text" setting, or per library with `dl_text="..."`.
* Added: `wrap="0"` shortcode option to keep each document on a single truncated row.
* Added: `scroll_offset` shortcode option so pagination jumps land below sticky theme headers.

= 2.12.3 =
* Added: quick "Documentation" and "Live demo" links on the WordPress Plugins screen.
* Housekeeping: set the plugin author link.

= 2.12.2 =
* Improved (Pro): a superseded document's page now declares the current version as its canonical URL, so search and answer engines consolidate ranking signal onto the live document instead of splitting it across old versions. The old page itself stays visible with its "superseded by" notice.
* Improved: the plugin description now leads with a plain definition of what FileDeck is.

= 2.12.1 =
* Fixed (Pro): "Download selected as zip" now works with lead capture. The zip button opens the same "enter your details" form as a single download and one submission covers the whole selection; previously the zip request was refused (every document needs a lead token) and the button failed without any message.
* Improved (Pro): if a zip download does fail, the button now says so ("Download failed — try again") instead of failing silently.

= 2.12.0 =
* New (Pro): client areas — assign users to a document category (usernames or emails on the category edit screen) and it becomes their private portal: enforced everywhere (libraries, search, downloads, single pages, WordPress' own REST/sitemap surfaces), with the new `[filedeck_my_documents]` shortcode showing each visitor only their spaces. Add `uploads="1"` and clients can send files into your moderation queue. Assigned users are emailed when new documents are published for them.
* New (Pro): unlike role/password restrictions (padlocked rows), client-area documents are absent from public libraries entirely — a client's document titles are themselves private.
* Developers: `filedeck_client_notification_email` and `filedeck_client_notify` filters.

= 2.11.1 =
* Fixed (AI): watermarked downloads fataled on front-end requests (wp_tempnam is admin-only; now loaded on demand, same as the zip route) — and any unexpected stamping failure now serves the original file and logs, instead of erroring.

= 2.11.0 =
* New (AI): dynamic PDF watermarking — every served PDF is stamped at download time with who received it, from where, and when (singles, every PDF in a zip, and view-only streams). Uses the server's Ghostscript; if it's unavailable the original is served and the failure logged. Documents → Settings → Downloads.
* New (AI): view-only documents — a per-document flag that disables the download button, zip inclusion and the raw file URL (the file moves to the protected vault) while visitors read the document in the browser via a new access-checked view route. Signed share links still download, by design. Framed honestly: deterrence, not DRM.
* Developers: new `filedeck_force_stream`, `filedeck_serve_path`, `filedeck_zip_entry_path` and `filedeck_doc_row` extension points (all inert in the free build), plus `filedeck_watermark_text` and `filedeck_gs_path`.

= 2.10.0 =
* New: per-document delivery control — choose whether each document's button forces a download or opens the file in the browser (Documents → edit → Delivery). "Open in browser" documents show a View button that opens in a new tab. Free feature.
* New (Pro): per-download notifications — an email and/or JSON webhook fires for every download, with the document, the user (or "a visitor"), and the running total. Emails are flood-capped at 200/day site-wide; the webhook is uncapped and non-blocking. Documents → Settings → Downloads.
* New (Pro): download quotas — daily download limits per role, and for logged-out visitors by IP. Zip downloads count per file; signed share links are exempt. Documents → Settings → Downloads.
* Developers: new `filedeck_downloaded` action (fires once per counted download) and `filedeck_download_allowed` filter (final allow/deny gate), plus `filedeck_default_delivery` for a site-wide delivery default.

Earlier releases and the full version history: https://www.getfiledeck.com/changelog/
