PDF Viewer Role
Creates a new user role "PDF Viewer" with specific permissions and a custom admin page for uploading/viewing/removing a PDF document.
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/breonwilliams/pdf_viewer_role/archive/refs/heads/master.zipReadme
PDF Viewer Role Plugin
Description
The PDF Viewer Role Plugin creates a new user role called "PDF Viewer" with specific permissions. This plugin includes a custom admin page for uploading, viewing, and removing a PDF document. It also provides a shortcode to display a login form and ensures that only users with the "PDF Viewer" role can access the PDF document.
Installation
- Download the plugin files and upload them to your WordPress site's
wp-content/pluginsdirectory. - Activate the plugin through the 'Plugins' menu in WordPress.
- Assign the "PDF Viewer" role to the users who should have access to the PDF document.
Usage
Uploading the PDF Document
- Go to the WordPress admin dashboard.
- Navigate to the
PDF Viewermenu. - Upload the PDF document using the provided form.
Removing the PDF Document
- Go to the WordPress admin dashboard.
- Navigate to the
PDF Viewermenu. - Click the "Remove PDF" button to delete the uploaded PDF document.
Displaying the Login Form
- Create a new page in WordPress.
- Add the following shortcode to the page content: [pdf_viewer_login_form]
- Publish the page.
Toolbar for PDF Viewer Role
When users with the "PDF Viewer" role are logged in, a custom toolbar will appear at the top of the website, including:
- A button to download the PDF document.
- A logout button.
Shortcode
[pdf_viewer_login_form]
This shortcode displays the default WordPress login form. If the user is logged in, the form is hidden.
Additional Information
- The admin page includes instructions on how to use the shortcode.
- Users with the "PDF Viewer" role are restricted from accessing the WordPress admin dashboard.
- The admin bar is hidden for users with the "PDF Viewer" role.
Customization
Feel free to customize the plugin code to suit your needs. If you encounter any issues or have suggestions for improvements, please let us know.
License
This plugin is licensed under the GPLv2 (or later) license.