Role-Based Document & Media Vault

A self-contained WordPress document management solution providing dedicated off-media-library secure storage, role-enforced file serving gateways, automated role generation, storage capacity tracking, and frontend components[cite: 1, 2].

Core Architecture & Functions

This plugin is architected for organizations that need strict document segregation and role-restricted file delivery without polluting the standard WordPress media library[cite: 2]:

Non-Media-Library Storage Files bypass standard uploads and are saved to wp-content/uploads/secure_vault_files/ (or a custom path via RDV_CUSTOM_STORAGE_PATH) guarded by .htaccess and silence index files[cite: 1, 2].
Protected Gateway Streaming Documents cannot be hotlinked or downloaded by direct URL[cite: 2]. Delivery requires temporary cryptographically signed nonces and role validation via PHP streaming[cite: 1, 2].
Dynamic Vault Roles Creating a Document Vault taxonomy term automatically spins up a corresponding vault-{slug} user role and an isolated storage folder on disk[cite: 1, 2].
Real-Time Quota Meters Storage quotas in megabytes are calculated using directory size checks and displayed both in the backend list tables and frontend shortcode upload forms[cite: 1, 2].

Setup & Configuration Workflow

  1. Configure Storage (Optional): Files default to wp-content/uploads/secure_vault_files/[cite: 1, 2]. To store files outside the webroot, define the path in wp-config.php[cite: 1, 2]:
    define('RDV_CUSTOM_STORAGE_PATH', '/var/www/secure_vault_storage');
  2. Configure Settings: Visit Vault Settings > General Settings to authorize backend access roles and set branding colors (Primary, Hover, and Storage Meter Bar)[cite: 1].
  3. Create Vaults: Navigate to Document Vaults, enter a Name (e.g., Board Minutes), assign a Storage Allocation (MB), and click Add New Document Vault[cite: 1, 2]. The matching vault-board-minutes role and subfolder are auto-generated[cite: 1, 2].
  4. Assign Roles to Users: Under Users > All Users, assign the generated vault-* role to members who should access or upload to the vault[cite: 1, 2].
  5. Copy & Embed Shortcodes: Go to the Document Vaults table view, copy the auto-generated shortcodes from the Shortcodes column, and paste them into your pages or builder templates (Divi, Gutenberg, Elementor)[cite: 1, 2].

Shortcodes & Usage Reference

1. Vault Document List — [role_doc_vault]

Renders a stylized file browser list displaying the vault icon, filename, upload date, uploader, file size, description, inline tab opening, and owner deletion controls[cite: 1, 2].

[role_doc_vault roles="vault-board-minutes,administrator" vaultowner="vault-board-chair"]
Parameter Default Description
roles administrator[cite: 1, 2] Comma-separated list of roles allowed to view the vault and stream its documents[cite: 1, 2]. Unauthorized visitors receive an empty placeholder[cite: 1, 2].
vaultowner (empty)[cite: 1, 2] Comma-separated roles allowed to physically delete documents using the trash icon[cite: 1, 2]. Administrators always retain deletion rights[cite: 1, 2].

2. Frontend Upload Form — [role_doc_upload]

Renders a drag-and-drop/browse file upload form with a real-time capacity progress meter[cite: 1, 2].

[role_doc_upload roles="vault-board-minutes,administrator" vaultowner="vault-board-chair" max_storage_mb="10"]
Parameter Default Description
vaultowner (empty)[cite: 1, 2] Required for uploading: Only users possessing this role (or Administrators) can see or submit the form[cite: 1, 2]. Others see nothing[cite: 1, 2].
roles administrator[cite: 1, 2] Comma-separated roles defining which vault folders this upload form associates with[cite: 1, 2].
max_storage_mb 0 (Unlimited)[cite: 1, 2] Defines the storage limit displayed in the meter bar[cite: 1, 2]. Cannot exceed the Admin allocation configured on the vault term[cite: 1, 2]. Uploads that exceed quota are rejected[cite: 1, 2].