Page 1 of 1

Specific Post/Page Protection also be part of Member group?

PostPosted: October 4th, 2011, 4:40 pm
by jmadigan
Say I use the specific post/page protection to sell a page as a product: Can I also sell access to this page with a membership?

If I do this can I keep it so that the individuals that just purchase the page don't have access to the rest of the pages the members do?

I want to sell the items that make up the membership separately, with the option to purchase access to all with a membership.

Finally, If a user wants to upgrade from post/page access to the membership am I bound by the 20% rule for PayPal?

Thanks for all the help!

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 4th, 2011, 4:54 pm
by Eduan
No, because you would then create a conflict, if a user has level 1 and buys access to a post/page that is supposed to be able to be viewed with level 2 he wouldn't be able to access it because it's for level 2, even though he paid access for it. This video provides a better explanation to what I said: http://www.s2member.com/specific-posts-pages-video/

Yes, as long as there's not a conflict (like the one described above).

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 5th, 2011, 2:12 am
by Cristián Lávaque
Specific Post/Page and Levels restrictions are mutually exclusive. What you could use is custom capabilities. http://www.s2member.com/custom-capabilities-video/

I hope it helps. :)

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 7th, 2011, 1:00 am
by kennymcnett
I've been trying to wrap my head around how this can be accomplished with custom capabilities. I really like s2member, so I'd like to be able to use it on my project. Any specific ideas to accomplish the scenario? The only way I can figure it out right now is to make duplicate content, one to be sold individually and the other as part of a subscription level or custom capability. Duplicate content is not ideal.

The scenario:

Video Post #1 - posted in category "Trees"
Video Post #2 - posted in category "Trees"
Video Post #3 - posted in category "Oceans"
Video Post #4 - posted in category "Oceans"

How to:
1. Sell the videos individually AND
2. Sell subscriber packages to the different categories AND
3. Sell a sitewide subscription to all content.

Thank you!

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 7th, 2011, 1:43 am
by Cristián Lávaque
In that example you could work with the following custom capabilities:

videos, video1, video2, video3, video4, trees, oceans

video1 for video post #1, video2 for post 2 and so on.

You can use trees and oceans in a conditional in the theme's functions file as explained by Jason in segment 2 of the video I linked to above.

videos could be checked for in both cases above. You'd sell this one to those that get access to everything.

So you can protect the video pages with conditionals instead of the metabox in the edit page. An example conditional would be:

Code: Select all
[s2If current_user_can(access_s2member_ccap_videos) OR current_user_can(access_s2member_ccap_video1)]
    Show video 1.
[/s2If]

[s2If !current_user_can(access_s2member_ccap_videos) AND !current_user_can(access_s2member_ccap_video1)]
   Show sales copy for video 1.
[/s2If]


or

Code: Select all
<?php if (current_user_can('access_s2member_ccap_videos') || current_user_can('access_s2member_ccap_video1')) { ?>
    Show video 1
<?php } else { ?>
    Show sales copy for video 1.
<?php } ?>


WP Admin -> s2Member -> API / Scripting -> Simple/Shortcode Conditionals
WP Admin -> s2Member -> API / Scripting -> Advanced/PHP Conditionals

http://www.s2member.com/custom-capabilities-video/

I hope this helps. :)

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 7th, 2011, 2:48 am
by kennymcnett
Thank you, Cristián, for your immediate, detailed response. That is phenomenal support.

3 follow-ups:

1. Does this mean I'll need to create a custom capability for each individual video? From what I understand, that simply means creating a subscription button that includes the new ccap, then using that ccap in the conditional inside the post, right?

2. If I make a third category, such as "Sitewide", could I also add that to the functions.php in conjunction with the other categories, then assign the post to both the "Trees" and "Sitewide" category? The logic for the functions.php being: If the category of the post is "Trees", then require ccap of "trees" OR "sitewide". Does that work? Any help on the actual php?

3. How does this tie into download restriction options? Since the video/image/file will be served from my secured s2members-files directory, and embedded into the post, I'm confused about where the custom capability applies. Is it applying to the video itself, or to the post? I need to deny access to anyone (regardless of subscription) attempting to access the video file directly instead of viewing it inside the post, because I don't want them downloading directly. (I know there are ways to download/capture content regardless, but I'd like to at least restrict the no-brainer direct URL download.) Or maybe I'm thinking about this the wrong way?

Again, thank you so much. I'm quickly becoming your newest evangelist.

Kenny

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 7th, 2011, 3:45 am
by Cristián Lávaque
Thanks for the kudos, Kenny! :)

1. Correct.

2. Exactly.

Code: Select all
<?php
add_action
('template_rediret', 'my_custom_capabilities');
function my_custom_capabilities() {
    if (is_category('trees') && (!current_user_can('access_s2member_ccap_trees' && !current_user_can('access_s2member_ccap_sitewide')) {
        header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
        exit;
    }
}
?>


3. You can protect file downloads with custom capabilities too. WP Admin -> s2Member -> API / Scripting -> Custom Capability & Member Level Files

I hope this helps!

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 8th, 2011, 4:42 pm
by kennymcnett
Spot on. Thank you. I understand how to lock posts for this scenario using ccaps.

But, to solve #3, I see that I can create subfolders in the s2members folder for each ccap. But, does that mean I would need to create a subfolder for each ccap I make? Meaning, each video in the example we've been referring to would need to be placed in its own subfolder? How, then, would I grant direct URL access for the other ccaps?

Summarizing: How can I grant multiple ccaps direct URL access to the same file? (in this example: ccaps are sitewide, trees, and video1).

Or is that even necessary?

Thank you again.

Kenny

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 9th, 2011, 2:31 pm
by Cristián Lávaque
Ah, good point... Sorry about that, forgot about that.

Then, instead of protecting the downloads with ccaps as described above, use the ccaps in conditionals in the download page and show the download link only to those that have the right access (the right ccap for it).

You can then protect the download using a download key. Read about it here: WP Admin -> s2Member -> Download Options -> Advanced

I hope that helps. :)

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 10th, 2011, 3:48 pm
by kennymcnett
Cristian, thank you for all of your help. To wrap up, I though you and future readers of this thread might like a summary of our solution.

Because this site will ultimately be maintained by a non-programmer client, here's the method I've chosen to use (also based on some insight from other threads on this forum).

1. Use s2member ccaps to grant access to posts individually and by category as we've discussed.

2. Embed video content in those posts from a 3rd party provider. I've chosen Vimeo's PRO account, which allows for restricted playback by domain and is ultimately cheaper than Amazon S3 or similar service. So, I will embed the video inside of a ccap-protected post, and in the Vimeo admin restrict playback to the client's domain only. Since we're not allowing the video to be downloaded, this solution gives us complete security and also leverages the speed of Vimeo's servers. More importantly, it's very simple for the client to upload any kind of video (Vimeo converts to appropriate filetype) and insert it into his post (via standard WP video insert methods), which post is automatically protected by the s2member's ccaps we assign.

3. Completely restrict access to the s2members-files folder.

4. In each protected post, make download links to any protected files using the shortcode for s2member authorization keys. It is simple for the client to hit the link button in the wordpress editor for any word or graphic in his post and insert
Code: Select all
[s2File download="example.zip" download_key="true" /]
into the URL box.

Suggestions:
A button on the post editor to insert a link to an auth-key file. For example, instead of clicking the standard wordpress link icon, I would highlight what I want to link and then click the "s2member protected file link" icon, which would pull up a list of the contents of s2member-files, allow me to select one, then insert the appropriate shortcode into the post/link data.

Related, it would be nice to have a file browser for the s2member-files directory so a client could upload new files without using ftp. (Like the WP media manager, but specifically for the s2member-files directory). An "insert protected file" icon seems ideal for a user that isn't a programmer.


Thank you again for your detailed and timely help. I had considered other plugins on the market, but your support kept me here. I will recommend s2 with full marks.

Kenny

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 10th, 2011, 4:03 pm
by Eduan
Thanks for the info.

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 11th, 2011, 1:38 pm
by Cristián Lávaque
Thanks for the kudos and sharing your solution, Kenny! :)

Yes, we're considering buttons for an improved interface in the editor.

About those, this thread may interest you: viewtopic.php?f=4&t=15449 It's not about the downloads, but you may work from that to add the ones you need.

That doesn't add a file manager, of course, I'll mention that to Jason, but I don't know when it'd happen.

Thanks for the suggestions!

Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 11th, 2011, 7:31 pm
by kennymcnett
I fidgeted with the categories restriction in the functions.php and came up with this instead, which lets my client make up any category he wants on the fly and the posts in that category are instantly protected by a ccap equivalent to the category's slug. Note: It seems that ccaps cannot include special characters, such as hyphens.

Code: Select all
<?php
/* Custom function for the s2member plugin. This denies access to content if user doesn't have a Custom Capability (ccap) equivalent to the category slug. If denied, user is redirected to the s2member subscription options page.
*/
add_action('template_redirect', 'my_custom_capabilities');
function my_custom_capabilities() {
   $category = get_the_category();
   $kat = $category[0]->category_nicename;
   if (in_category($kat) && (!current_user_can('access_s2member_ccap_' . $kat))) {
        header('Location: ' . S2MEMBER_MEMBERSHIP_OPTIONS_PAGE_URL);
        exit;
    }
}
?>


Re: Specific Post/Page Protection also be part of Member gro

PostPosted: October 12th, 2011, 6:21 pm
by Cristián Lávaque
Very nice work! I love dynamic solutions like that. :)