Membership and Pay Per Post Plug In Help

Hi,

I have to develop an intricate membership site. I am wondering if the pro version of the membership plug-in supports / protects custom post types and/or their taxonomies. I tried the free version and it looks like it does not.

Also, does the Pay Per Post plug in integrate/work with the membership plug in? I have an odd situation in which I need to allow portions of posts (that will be custom fields) to be paid for. Access to every post's fields need to be paid for on a per post basis. I could use a membership level IF I didn't have to pay for the posts individually. My posts will be always changing so I feel the pay per post concept is probably the best way to accomplish this.

If you need further explanation please let me know. It gets somewhat confusing, I know :slight_smile:

  • aristath

    Hello there @streetfire, I hope you're well today!

    I am wondering if the pro version of the membership plug-in supports / protects custom post types and/or their taxonomies. I tried the free version and it looks like it does not.

    Well, not exactly... it can't natively manage custom post types or taxonomies... but you can use URL groups to do these kinds of things, or even custom-code something if the URLs don't help.

    As for the pay-per-post scenario you described, could you please provide some more details?

    Please advise,
    Ari.

  • streetfire

    Ari, Thank you and here goes...

    First, I will have a custom post type that needs protection by a membership level (Hopefully WPMU membeship)

    Under that CPT, I will have custom taxonomies.

    My single posts in the taxonomies will be shown as a list.

    Each single post will have custom fields. A few of the custom fields in EACH post will have content that I need to require customers to pay for.

    Now, a payment to access a post's restricted custom field content needs only to apply to that post. All other custom fields under separate posts must be paid for on a per post basis.

    For example:

    Post 1 - $12 for access (gives access to protected fields)
    -----------------------------
    Post name: My #1 Article
    Body content: "content..." ** Not protected**
    Custom Field Example 1: "Download Research PDF #1" ** Not protected**
    Custom Field Example 2: "Download Research PDF #1" ** PROTECTED**

    Post 2 - $12 for access (gives access to protected fields)
    -----------------------------
    Post name: My #1 Article
    Body content: "content..." ** Not protected**
    Custom Field Example 1: "Download Research PDF #1" ** Not protected**
    Custom Field Example 2: "Download Research PDF #1" ** PROTECTED**

    I want to be sure that if they pay for access to Post 1, they are not also granted access to the protected content in Post 2. It needs to be a separate payment.

    I sure hope this helps. I must say, this is quite a challenging project for me.

  • Tyler Postle

    Hey streetfire,

    Hope you're doing well today!

    Yes, so as my colleague Ari mentioned, you will be able to protect custom post types with the URL groups. Here are some links with more information on doing that: http://youtu.be/nVepd0HGOh8 (video tutorial) and our Membership PDF Guide (page 38).

    Then with Pay Per View you can use the selected content feature per post to wrap the content you want protected with some shortcode, the rest of the post will be visible as long as the user/visitor has access via Memberships access rules :slight_smile:

    Hope that helps! Let us know if you still have any questions/concerns here.

    All the best,
    Tyler

    • Tyler Postle

      Hey Streetfire,

      Hope you're doing well today.

      I'm actually not sure I understand your goal here. So, you are wanting it to automatically protect the PDF's you upload? Will they all be at a specific path? ie. domain.com/uploads/pdf/pdfname? If that's the case then you can still use URL groups on this.

      Another thing you may want to look into here is the media protection feature in Membership: https://premium.wpmudev.org/wp-content/uploads/2010/05/Membership-Manual3450.pdf (page 26)

      You can create protected groups then whenever you upload the PDF you can add it to the protected group :slight_smile:

      This way, only members who have an access level for that specific protected media group will be able to view the link.

      If I'm misunderstanding the issue here then just let me know! Happy to help further if needed.

      All the best,
      Tyler

  • streetfire

    Hi Tyler, I am doing well thanks. :slight_smile: I know it sounds a little confusing and I'll admit a tricky request from my client. Let's see if I can help you understand better.

    My client is wanting to protect certain pieces of the posts that he makes (via a custom post type). I plan to make custom fields (via Advanced Custom Fields plug in) for him to upload the content he wants to protect. The content/custom fields will be a variety of text, images, files, etc.

    The trick party is, I am not interested in protecting the main body of the content - only the custom fields I choose.

    Also, it get's trickier... my client will be adding / updating the custom field's content on a weekly to daily basis and it will be too much trouble for him to insert custom shortcodes to protect the content for EACH post.

    I am looking for a way to implement a code into my custom post single template (single-mycustomposttype.php) that will allow the website to auto-protect any content my client uploads to the custom fields. However, I still want the post content to be purchased on a per post basis.

    For example, my client publishes some posts - one called Gold, one called Silver. I want the customer to be able to purchase the private content of Gold without also being given access to Silver. I also don't want my client to have to manually protect each posts' content every time he posts something new - as he will be doing a lot of posting. I need the content to be protected in the template file. I hope this makes sense. Let me know what you think.

    Due to the dynamic nature of this content it seems I will have to use a pay per post type feature for this. Access levels via membership will not work since the content (posts) will be changing frequently.

    Thanks again for your help!!!

  • aristath

    Hello again @streetfire,

    This can be done, however you will have to do some custom coding and probably completely custom-code the template file.

    pay-per-view.php, lines 628-778 contain the main "protection" function of the pay-per-view plugin.
    That function is applied to the main content from line 67 of that same file:
    add_filter( 'the_content', array( &$this, 'content' ), 8 );

    So in your custom template file, you'll have to remove that filter.
    After you do, your main content will NOT be blocked by the plugin any more and you can start implementing this for your custom fields.

    So let's assume you have a custom field called my_custom_field.
    You can do something like this to get its content:
    $my_custom_field_content = get_post_meta( get_the_ID(), 'my_custom_field', true );
    Then to pass that through Pay Per View and only display it if the user has paid for this post you'd do something like this:

    global $ppw;
    $my_custom_field_ppv = $ppv->content( $my_custom_field_content );
    // Echo the content from our custom field after we pass it through PPV
    echo $my_custom_field_ppv;

    I haven't tested the above but it should work...

    I hope that helps!

    Cheers,
    Ari.

  • Tyler Postle

    Hey Richard,

    Hope you're doing well!

    There should be more to that error that will tell us in which file it happened and on what line. Do you mind posting that as well? That will help us determine the issue here :slight_smile:

    Also, for future reference, do you mind creating a new topic in situations like this? You can always link to the related thread too. This way threads don't end up getting super long and we can provide more efficient support for each member.

    Look forward to your reply Richard!

    Cheers,
    Tyler

  • streetfire

    Hi again Ari. I hope it's okay to continue this thread. My questions are still related. I am finally trying to implement pay per view with my custom theme.

    So far, it's not working yet. Let's start with Step 1. My first issue is where you give the code to call my custom field:

    $my_custom_field_content = get_post_meta( get_the_ID(), 'my_custom_field', true );

    I cannot get this to display when inserting it into my template and substituting my field name, which is "macro_map".

    This code, however, does display my field contents.

    <?php the_field('macro_map'); ?>

    Perhaps if I got this fixed, the rest would come together.

    Also, I was looking at pay-per-view.php in the plug ins' root folder. Are the start/end lines you gave above still correct? For example I found the following to be on line 133... maybe I'm looking at the wrong thing?

    add_filter( 'the_content', array( &$this, 'content' ), 8 );

  • Tyler Postle

    Hello there @streetfire, I hope you're well today!

    So far, it's not working yet. Let's start with Step 1. My first issue is where you give the code to call my custom field:

    $my_custom_field_content = get_post_meta( get_the_ID(), 'my_custom_field', true );

    I cannot get this to display when inserting it into my template and substituting my field name, which is "macro_map".

    That line of code does NOT echo anything on your screen. It never was meant to do that.
    That line of code simply sets the variable $my_custom_field_content to the value of the 'my_custom_field' post meta.

    You need to do this afterwards to echo it:
    echo $my_custom_field_content
    If you take a look at the full code Ari posted above, you will see that it's there.

    I hope that clarifies it!

    Cheers,
    Tyler.

  • streetfire

    @Tyler, I previously found a workaround - that at least shows the fields - using this:

    $my_custom_field_content = the_field('symbol_news_links');

    If I need to use Ari's code above can you help me know where to stick the field name 'macro_map' ? Perhaps I wasn't filling it in all the correct spots.

    Also, I created a new post needing more help on this issue as I thought this one was closed. Ari was supposedly tagged on it, but so far I've not had a reply from him. I really need help on this asap. Thank you :wink:

    https://premium.wpmudev.org/forums/topic/need-help-setting-up-template-with-pay-per-view#post-719811

    P.S. That was created with another account of mine that I made for my clients. It's still me posting. Should we continue here or there?

  • Running Alpha Admin

    Inserting this code, I get an error. 'symbol_news_links' is my custom field name.

    Code

    <?php   $my_custom_field_content = get_post_meta( get_the_ID(), 'symbol_news_links', true );
    
    global $ppw;
    $my_custom_field_ppv = $ppv->content( $my_custom_field_content );
    // Echo the content from our custom field after we pass it through PPV
    echo $my_custom_field_ppv; ?>

    Error

    Fatal error: Call to a member function content() on a non-object in /home/runningalpha/public_html/wp-content/themes/runningalpha/single-100indexlist.php on line 94

  • Running Alpha Admin

    Update: When I use this code suggested in another post, and insert the_field from ACF in place of get_post_meta the fields show up, but are not protected.

    <?php
    if ( function_exists( 'wpmudev_ppw_html' ) ) {
        $test = the_field('macro_map');
        $test2 = the_field('symbol_news_links');
        global $ppw;
        if ( !is_object( $ppw ) )
            return;
        $my_custom_field_ppv = $ppw->content( $test );
        $my_custom_field_ppv_2 = $ppw->content( $test2 );
        // Echo the content from our custom field after we pass it through PPV
        echo $my_custom_field_ppv;
        echo $my_custom_field_ppv2;
    }
    ?>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.