PDF Gated Download
The PDF Gated Download plugin is a WordPress plugin designed to gate PDF downloads behind an enquiry form. Instead of giving users direct access to a PDF file link, they must first enter their name, email, and a message. Once submitted, the lead details are recorded, and they receive a secure, temporary download link.
by Artificial Intelligence · github.com/7418sathish/pdf-gated-download-plugin-
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/7418sathish/pdf-gated-download-plugin-/archive/refs/heads/main.zipA lightweight, secure WordPress plugin to gate PDF downloads behind an enquiry/lead capture form. Instead of exposing raw PDF attachment URLs to visitors, users must submit their contact details, after which they are redirected to a temporary, secure download link.
Features
- Lead Generation: Captures visitor Name, Email, and Message before allowing them to download files.
- Secure File Delivery: Generates a secure, single-use download token valid for only 5 minutes (using WordPress Transients) to prevent direct link sharing.
- WordPress Media Library Integration: Adds a Gated PDF Settings box to Pages, Posts, and custom post types to easily assign a PDF.
- Admin Dashboard: Includes a PDF Submissions page under the admin panel to view captured leads and configure settings.
- Email Notifications: Optionally alerts the site administrator via email whenever a user submits the gated form.
- Ajax-Powered Form: Standard frontend styling and JavaScript-driven validation for smooth, page-reload-free submissions.
Installation
- Upload the
pdf-gated-downloaddirectory to your/wp-content/plugins/directory. - Activate the plugin through the Plugins menu in WordPress.
- Upon activation, the plugin automatically creates a custom database table (
wp_pdf_gate_submissions) to store lead details.
Usage & Shortcodes
1. Automatic Gating (Recommended)
- Go to any Page or Post edit screen.
- In the Gated PDF Settings metabox (located on the side panel), click Select PDF and choose a file from your Media Library.
- Insert the following shortcode anywhere in your content:
[enquiry_pdf_gate]The plugin will automatically identify the PDF assigned to that page and serve it.
2. Gating a Specific PDF
To gate a specific PDF anywhere on your site, pass its Media Library Attachment ID directly to the shortcode:
[enquiry_pdf_gate pdf_id="123"]
File Structure
pdf-gated-download/
├── assets/
│ ├── admin.js # Admin media uploader script
│ ├── script.js # Frontend form handler (AJAX & redirection)
│ └── style.css # Frontend form styling
├── includes/
│ ├── class-admin.php # Admin menus, settings, and metabox
│ ├── class-ajax.php # AJAX endpoints (lead capture & secure streaming)
│ ├── class-db.php # Database table operations (submissions CRUD)
│ └── class-frontend.php # Shortcode registration & frontend assets
├── templates/
│ └── single-pdf_download.php # Custom single post layout
└── pdf-gated-download.php # Main plugin bootstrap file
License
This project is licensed under the GPLv2 or later.