Pay Per View plugin does not hide Upload File in CoursePress

I need to charge users for EACH file upload within a free course (using Coursepress Pro) and would like to use PayPal to charge them (using Pay Per View) before they can Upload a File.

The File Upload should only show after payment, but is not working properly, despite trying each of the three settings (auto/manual/select)



  • James Morris

    Hello Sean,

    I hope you are well today.

    I've taken a look at your site and run some tests on my own install. Since CoursePress builds it's content using virtual pages, I don't believe you will be able to do what you are wanting to do with Pay Per View without a significant amount of custom coding. However, I'm going to ping our Dev Team to see if there is a hook that can be added to your functions.php to make this possible.

    Please keep in mind that our Dev Team is quite busy working on fixes and features for all our plugins. So, it may take a little longer than usual to get their valuable feedback. As soon as more information is available, it will be posted here.

    Best regards,

    James Morris

  • James Morris

    Hello Sean,

    I just happened to catch the developer of the Pay Per View plugin. I'm afraid what you are wanting to do cannot be done without a custom coded solution, which goes beyond what I'm able to provide you with here. The issue is as I mentioned above: CoursePress builds its pages virtually. Pay Per View works with content inside posts and pages. These two do not integrate well. To get this to work, you would have to make significant changes to the CoursePress plugin, which is not advisable.

    The simplest solution would be to charge for your courses. However, if this is not an option for you, and this feature is a must for your business model, you may want to post your custom coding requirements on the Jobs & Pros board where other developers from the community can bid on providing a solution for you. Please note: The developers on the Jobs board are not associated with WPMU DEV.

    I'm sorry I was not able to provide you with a simpler solution in this situation.

    Best regards,

    James Morris

  • Sean

    Thanks James.

    I was about to reply to your first reply, when I noticed you had replied again.

    Here is the info. from the plugin: Pay Per View > Global Settings;

    Protection for custom post types (Enabled/Disabled)
    You have the following custom post type(s): Membership2 Memberships, Membership2 Invoices, CoursePress Pro Note: See the below customization section for details.

    Public content selection method (Auto/Manual/Select)
    Automatic excerpt selects the first 100 words, number being adjustable from "excerpt length" field. Manual excerpt displays whatever included in the post excerpt field of the post. With selection tool, you can freely select part(s) of the content to be protected. Using the latter one may be a little bit sophisticated, but enables more than one part of the content to be protected.

    Here is the info. from the plugin: Pay Per View > Customization Help

    Customization Examples
    For protecting html codes that you cannot add to post content, there is a template function wpmudev_ppw_html. This function replace all such codes with payment buttons and reveal them when payment is done. Add the following codes to the page template where you want the html codes to be displayed and modify as required. Also you need to use the bottom action function.

    if ( function_exists( 'wpmudev_ppw_html' ) ) {
         $html = '<iframe width="560" height="315" src="" frameborder="0" allowfullscreen></iframe>'; // html code to be protected (required)
         $id = 1; // An optional unique id if you are using the function more than once on a single page
         $description = 'video'; // Optional description of the protected content
         $price = '1.50'; // Optional price for a single view. If not set, price set in the post will be applied. If that is not set either, Unit Price in the Global Settings will be used.
         echo wpmudev_ppw_html( $html, $id, $description, $price );

    Note: In this usage, enabled/disabled and method settings of the post has no significance. Such an html code will be fully protected. However, Accessibility Settings will be applied.

    Some custom post types use templates which take the post content directly from the database. For such applications you may need to use wpmudev_ppw function to manage the content.
    Example: Suppose that the content of a post type is displayed like this: <?php echo custom_description(); ?>. Then edit that part of the template like this:

    if ( function_exists( 'wpmudev_ppw' ) )
         echo wpmudev_ppw( custom_description() );
         echo custom_description();

    For both of the above usages you must create a function in your functions.php to call necessary css and js files. Here is an example:

    function my_ppv_customization( ) {
         global $ppw, $post;
         if ( !is_object( $ppw ) || !is_object( $post ) ) return;
         // Call this only for a post/page with ID 123. Change as required.
         // If you omit this line, js and style files will be added to all of your pages and caching will be disabled. So it is recommended to keep and modify it for the pages you are using.
         if ( $post->ID != 123 ) return;
    add_action( 'template_redirect', 'my_ppv_customization', 2 );

    If you want to apply your own styles copy contents of front.css to your theme css file and add this code inside functions.php of your theme:add_theme_support( "pay_per_view_style" ) OR copy and rename the default css file /wp-content/plugins/pay-per-view/css/front.css as /wp-content/uploads/pay-per-view.css and edit this latter file. Then, your edited styles will not be affected from plugin updates.

    Is this the "significant change" to CoursePress that you are referring to?
    Could you give me an idea of how much work is involved to make these changes? (time, cost, skill etc.)
    I am quite prepared to make these changes myself, with your professional, excellent support.

    Alternatively, would another combination of plugins enable me to achieve what I am trying to do, as mentioned in my other post here ?

  • Sean

    Here's another peculiarity about this plugin;

    When I select the first Pay $5 for access, it simply reloads the page (failing to triger the paywall), but when I select the Pay $50 for one month access or the Pay $500 for one year's access, both trigger the paywall, and successfully return me to the website from PayPal's Sandbox, and enable me to access all the course content (as is should).

    This indicates to me that the default "One time view" is faulty...

    One time view Visitors pay per content they want to reveal. Price can be set globally from the above "unit price" field, or per post basis using the post editor. Does not require registration of the visitor.
    One time view description Pay only $PRICE to see this DESCRIPTION

    This text will be shown on the button. PRICE (case sensitive) will be replaced by its real value. DESCRIPTION (case sensitive) will be replaced by description field defined in Selection Tool, or the word "content" if it is not given.

    Please could you help me to troubleshoot this option, which is the CORE FUNCTIONALITY that this plugin is supposed to provide.

  • Luís

    Hi Sean ,

    Hope you're doing well today!

    Firstly, sorry for the late reply and all the problems it may have caused.

    If I understood well, you already overcome one step and was able to integrate Pay Per View and CoursePress. The issue now is regarding to the "One time view" and "Period Pass" options.

    I would like to get the valuable feedback of your SLS team (our code experts :slight_smile: ) , so, can you please send us the FTP details of your website so they can investigate it further?

    Please send it privately through our contact form:

    Send in:

    Subject: "Attn: Luis Lopes"
    - WordPress admin username
    - WordPress admin password
    - Login url
    - FTP credentials (host/username/password)
    - Link back to this thread for reference
    - Any other relevant urls/information

    Cheers, Luís

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.