Restrict Post Attachments and Downloads

Protect Post Attachments and Downloads

This feature allows you to add file attachments into your posts/pages/custom post types. You theme/plugin should support the_content filter in posts/pages/custom post types to use this features.  You can use this feature to add additional files related to your posts/page.

You can add unlimited attachments to posts/pages and restrict viewing and downloading those attachments to guests, members or specific user roles on your site. You can assign permission levels within each file.

Limitations in Free Version

  • Post attachments are uploaded to default uploads folder. PRO version uploads the attachments to plugin specific folder inside uploads folder.
  • Attachments are restricted inside the post/page. However, attachments are accessible directly without restrictions through the URL in uploads folder.  Direct access to PRO version attachments can be blocked using .htaccess file.

This feature is not supported on

  •  Woocommerce – Products
  • Easy Digital Downloads – Downloads
  • bbPress – Forums and Topics

Adding File Attachments to a Post

Support for file attachments is enabled by default for All posts/pages and custom post types, except the types mentioned in the previous section.  Go to Pages -> Add New or Posts -> Add New and you will see the following meta box in the post/page edit screen.

file-attach-1

You can see the WP Private Content Plus – File Attachment Settings meta box on the bottom. You can add a Title and Description to be displayed in post/page before the file list. This will be general information about the attched files and how you can use them.

Next, you can add attachments to the post/page by using WP Private Content Plus – Manage File Attachments meta box as shown in the following screenshot.

file-attach-2

You have to click Add Files section to open the WordPress media uploader. Then you can upload any kind of file allowed by WordPress by default. Once you click Insert Into Post button after uploading a file, it will be added under the Add Files button with list of fields as shown in the following screen.

file-attach-3

Let’s take a look at available settings for each file.

  • File Name – This will be the name displayed on file list under the post/page. By default, name of the file will be displayed after uploading. You can change it to a more user friendly name.
  • File Description – This setting is not used at this stage. It will help you to identify the content of the file.
  • File Visibility – This settings defines the users allowed to view this file on list. You can make the file visible to everyone, guests or members.
  • Download Permission – This setting users allowed to download this file from the list.  You can make the file downloadable to everyone, guests or members. If user don’t have download permission, they will only see the file in the list without the download link.

Displaying File Attachments on a Post

Once files are attached to a post/page, it will be displayed by default to the users with necessary permissions.  This plugin uses the_content filter to display the files list and hence your theme and plugins should support the the_content filter on necessary pages. Following screenshot previews file attachments inside a post with download links.

file-attach-4

[mpc_textblock content_width=”100″ font_preset=”mpc_preset_17″ font_color=”#ffffff” font_size=”22″ margin_divider=”true” mpc_tooltip__border_divider=”true” mpc_tooltip__padding_divider=”true” class=”wpexpert-wpro-ad-free-docs-static-text”]WP Private Content Pro[/mpc_textblock][mpc_animated_text duration=”1000″ delay=”2650″ text_font_preset=”mpc_preset_17″ text_font_color=”#ffffff” text_font_align=”center” text=”Extend Features of Free Version|||Simple Setup|||Advanced Restriction Rules|||Membership & Private Page Management|||Priority Support|||” text_border_divider=”true” text_padding_divider=”true” disable_sides=”true” sides_font_preset=”mpc_preset_17″ sides_font_color=”#ffffff” sides_font_align=”center” border_divider=”true” padding_divider=”true” margin_divider=”true” class=”wpexpert-wpro-ad-free-docs-animated-text”][mpc_button preset=”mpc_preset_29″ url=”url:https%3A%2F%2Fwww.wpexpertdeveloper.com%2Fwp-private-content-pro%2F|||” font_preset=”mpc_preset_20″ font_color=”#ffffff” font_size=”16″ font_transform=”uppercase” font_align=”center” title=”VIEW MORE” background_color=”#2bb3e7″ border_divider=”true” border_top=”2″ border_right=”0″ border_bottom=”2″ border_left=”0″ border_style=”solid” border_color=”#ffffff” border_css=”border-top:2px;border-right:0px;border-bottom:2px;border-left:0px;border-color:#ffffff;border-style:solid;border-radius:0px;” border_radius=”0″ padding_divider=”true” padding_top=”12″ padding_right=”32″ padding_bottom=”12″ padding_left=”32″ padding_css=”padding-top:12px;padding-right:32px;padding-bottom:12px;padding-left:32px;” margin_divider=”true” margin_top=”11″ margin_css=”margin-top:11px;” hover_font_color=”#2bb3e7″ hover_background_color=”#ffffff” hover_background_effect=”expand-horizontal” hover_background_offset=”0″ hover_border_divider=”true” hover_border_css=”border-radius:0px;” hover_border_radius=”0″ mpc_tooltip__border_divider=”true” mpc_tooltip__padding_divider=”true” class=”wpexpert-wpro-ad-free-docs-button”]