If you’re running a website that offers PDF files for download or viewing, you might want to restrict access to certain files to certain users. Fortunately, PDF viewer for WordPress and WP File Access Manager makes this easy to do.
With these two plugins, you can set permissions on your PDF files so that only certain users can view them. If a user tries to access a PDF file they’re not allowed to see, they’ll see a “sorry” page instead. And with the .pvfw-not-allowed CSS class, you can customize this page to match your site’s look and feel.
Here’s how to get started:
- Install PDF viewer for WordPress and WP File Access Manager
If you haven’t already, install these two plugins on your WordPress site. They’re available on CodeCanyon.
- Upload your PDF files
Once you have the plugins installed, upload your PDF files to your WordPress site using PDF viewer for WordPress. Be sure to set the file’s permissions using WP File Access Manager.
- Customize the “sorry” page
To customize the sorry page, you need to add some code to your website. The code can be found at this GitHub link:
Once you have the code, you can add it to your website by following these steps:
- Copy the code from the GitHub link.
- Log in to your website’s WordPress dashboard.
- Go to Appearance > Theme Editor.
- Click on the “functions.php” file on the right-hand side.
- Scroll down to the bottom of the file and paste the code you copied earlier.
- Click the “Update File” button to save the changes.
That’s it! You have now customized the sorry page for protected PDF files. Viewers who are not allowed to see the PDF will be redirected to this page, and you can customize it however you like using CSS.
0 Comments