In this article and the embedded video I will demonstrate how to prevent access to video content from non-paying members or members without sufficient privileges, on your WordPress site.
There are a few different ways you can limit access to your protected videos and make it only available to your members. In this tutorial I will cover an in-depth method of making videos available to your members only or a customer can buy an individual video and view that video.
You should also check out this other simple option to protect videos.
What Plugins I will Use in This Tutorial
I am going to use the following two WordPress plugins for this tutorial
- WP eMember
- WP eStore
These instructions will allow you to provide access to video content in two different ways, for those that are members at the appropriate membership level, and for those who purchased “pay per view” or PPV access. PPV access grants access to one or more videos depending on what was purchased, rather than the “whole lot” which is available to paying members.
Video Tutorial
Setting up the Video Display Page
In the video example you will see that I setup a page that gives visitors a view of all the video courses that are available. Regardless of whether the individual is logged in or not, or what privelegs they have, they will see a thumbnail of the video.
If the visitor is a logged in member with appropriate access, he or she will be able to click the video thumbnail, or the accompanying “Watch Now” link to gain access to the video watch page.
For those that are not logged in, or those that are logged in but aren’t at the appropriate membership level, they will see “add to cart” buttons rather than “watch now” links.
Pay Per View access is not taken into account on this page.
Below is the code, including the shortcodes that could be added to the video display page. Modify the code to adopt it for your needs.
At the top of the page in the sample showed in the video I have a welcome message that changes based on whether the visitor has access to the content or not.
[emember_protected for=2 custom_msg='No access'] If you see this text then you have access [/emember_protected]
In the above code it checks whether the visitor is logged in and has a membership level of 2. You can determine the appropriate membership level ID to use by going to WP eMember >> Membership Level.
The custom message will accept HTML so you can ask the visitor to “login” or “join” if desired, and link them to the appropriate place. Just be sure to use single quotes to wrap around your custom message and double quotes in your HTML (or vice versa). Also, do not use square brackets in your custom message. I have also found that using more than one break tag in a row generates undesirable results.
Check the partial protection documentation to learn more on the usage of this shortcode.
The other message, the message that shows when the visitor has full access to the content, can explain how to gain access to the content. In my example, I explained to click the “watch now” link to watch the video.
Here is the code used to show either the “add to cart” button or “watch” link below the video thumbnail/description.
[emember_protected for=2 do_not_show_restricted_msg=1] <a href="#">Watch Now</a> [/emember_protected] [emember_protected scope=not_logged_in_users_only] [wp_eStore_add_to_cart id=1] [/emember_protected] [emember_protected not_for=2 do_not_show_restricted_msg=1] [wp_eStore_add_to_cart id=1] [/emember_protected]
Here we are again checking for membership level “2” and if found, it links to the video watch page for that particular video. Note: The URL for the video watch page is no secret, the plugins will work to keep the video protected even though the page is publicly accessible.
The next two bits of code may seem redundant but they are checking for two different scenarios even though the results are the same.
One block is displaying content if the visitor is “public” (i.e. not logged in) and the other is displaying content if the visitor is in fact logged in but doesn’t have sufficient privileges. Either way, we are providing an “add to cart” button which will give them access to that individual video.
Somewhere on the page we should also indicate that they can save money (assuming that is the case) if they pay for a full membership rather that buying access to videos on an individual basis. I have seen this scenario where commonly one month of access to all content is slightly less than the cost of two or three individual videos.
Setting Up the Video Watch Page
The video watch page is a public URL but has a section with protected content (the HTML that displays the video). This video HTML can be to YouTube, but in order to keep it really secure it might be best to use a solution such as Amazon.
At any rate, the video watch page checks a few different scenarios before deciding what to display to the visitor.
First off, members with proper access gain access to the video content. Secondly, non-members with pay-per-view access are allowed to view the video content as well. Everyone else sees a thumbnail and a buy button.
Below is the code to grant users who are logged in and have sufficient access (i.e. members), the ability to stream the video. In some cases (when using Amazon AWS for example) you can also provide a download link for the video from within the HTML that is displayed to visitors with sufficient privileges.
[emember_protected for=2 do_not_show_restricted_msg=1] HTML to display and optionally download the video content [/emember_protected]
Just like before, we are looking for membership level of 2. If the current visitor’s membership level is not 2, we do nothing. This is why “do_not_show_restricted_msg” is set to 1. This tells the shortocde not to display the default “insufficient access” message for non-privileged users.
After that (below) we have code for logged in users that aren’t at the proper membership level. If you remember, when taking into account pay per view access, this doesn’t necessarily mean that they can’t view the content. For that reason we are using the “wp_eStore_APR” shortcode to check for the cookie that shows that they paid (per view).
We are also considering non logged in users with this code. Non logged in users may very well have access to the video content as well on a pay per view basis. If not, we give them their options (login, pay for a membership, or pay for individual access).
[emember_protected not_for=2 do_not_show_restricted_msg=1] The code in here is displayed and executed when members ARE logged in but don't have membership level access to ALL content [wp_eStore_APR expiry=0 status=unexpired] HTML to display and optionally download the video content. This is displayed for those that have PPV access. [/wp_eStore_APR] [wp_eStore_APR expiry=0 status=expired] This is displayed for those that DO NOT have PPV access. It is appropriate here to include a "buy now" or "add to cart" button, or a link to get membership access. [/wp_eStore_APR] [/emember_protected] [emember_protected scope=not_logged_in_users_only] The code in here is displayed and executed when members ARE NOT logged in [wp_eStore_APR expiry=0 status=unexpired] HTML to display and optionally download the video content. This is displayed for those that have PPV access. [/wp_eStore_APR] [wp_eStore_APR expiry=0 status=expired] This is displayed for those that DO NOT have PPV access. It is appropriate here to include a "buy now" or "add to cart" button, or a link to get membership access. [/wp_eStore_APR] [/emember_protected]
Setting up the “Product” for the Video
Now, the above code is really just the first step to getting pay per view to work.
Using eStore we now must setup a product for each video. There are a couple required fields here:
a) product name of course
b) product price naturally
…and in the Digital Content Details section:
a) Digital Product URL: this is the link to the page for the video (created above) – be sure to replace “http” with “aprtp” (or “https” with “aprtps”) in the full URL
b) Uncheck “Downloadable”
Now, when someone purchases individual access (or pay per view access) to a video, they will be given a “download” link in an email. Of course, they will not be downloading the video watch page, but visiting/viewing it instead.
Upon visiting the page, the cookie will be checked, and the individual will be able to watch the video (i.e. view the hidden PPV content, whatever it may be).