PDA Gold helps protect your WordPress files from unauthorized users. So when someone attempts to access your protected files without permission, they will be redirected to a 404 not found page.
However, in case unwanted users manage to find ways to download these files, chances are they can still view the files. To avoid this from happening, file encryption comes into play.
Once the files are encrypted, they cannot be viewed and used by unauthorized users. In other words, only those with the file access permission are allowed to view encrypted files. So you don’t have to worry about unauthorized downloads anymore.
Requirements:
- Prevent Direct Access version 2.7.0 or greater
- Prevent Direct Access Gold version 3.3.1 or greater
How to encrypt & decrypt protected files
Step 1: Go to Media Library List View to protect your files.
Step 2: Select the file that you want to protect, choose “Configure file protection” and click on the “Protect this file” button.
Step 3: Once the file is protected, you will see a new “Encrypt this file” button.
When you hit this button, your protected file will be encrypted. Then you will see an “encrypted” badge display.
Similarly, if you want to decrypt this file, simply click on the decrypt button.
Auto encrypt protected files
To encrypt your protected files automatically, simply add the following custom codes to your (child) theme’s functions.php file.
// Auto encrypt files after protecting upon uploads add_action( 'pda_after_protect_file_when_upload', function ( $attachment_id ) { $service = new \PDAGOLD\modules\Files\Service(); try { $service->encrypt_file( $attachment_id ); } catch ( Exception $exception ) {} }, 10 ); // Auto encrypt files after protecting add_action( 'pda_after_protected', function ( $attachment_id ) { $service = new \PDAGOLD\modules\Files\Service(); try { $service->encrypt_file( $attachment_id ); } catch ( Exception $exception ) {} }, 10);
Logic & Limitations
- You cannot encrypt or decrypt protected files if the encryption key is wrong and/or missing.
- You can only rewind or fast-forward encrypted video and audio files on Firefox browser. This feature will soon be supported on other browsers in the future, e.g. Chrome, Safari, Microsoft Edge, Opera.
- When there are more than 10,000 encrypted files on your site, you might get a timeout error when trying to deactivate our plugins.