Understanding custom capabilities

I have S2pro setup in Wp.

I want to have 2 independent products available for sale that can be purchased independently regardless of the level.

I understand this action can be controlled with custom capabilities.

In the video they use a and b as examples for capabilities. How is a and b defined? Where do we establish that?

Please explain how 2 products could be setup using ccapabilities and keeping only level 0 and level 1.

Thank you.

Marie, you define the capabilities (ccaps) yourself in the s2Member box on a post’s or page’s edit screen, in the line below the one that deals with levels.

As for how to set up what you are looking for, it depends on whether you want to sell these products only to members, or whether you want to sell them to people who aren’t members at all, and never will be.

Hi Tim,
Thanks Tim in clarifying where ccaps are set…

The sales funnel would bring prospects to signing up as a free member. In there the products would be sold to members only whether free or paid.

Would ccaps handle that easily?

However, if there were sales pages outside of S2 pushing them directly to one of the paid products, I am assuming that they could sign up as a paid member right away and get access to their product. Is that right? and access to their product would also be identified using ccaps.

Please add your comments.
Thanks

Marie, so long as you always want those buying these products to join up as a member, then it is all quite straightforward. You just add the ccaps to the posts or pages as desired, and sell them using the appropriate form shortcode (i.e. including the appropriate ccap).

The only other thing you need to watch out for when doing this is that, if the posts and pages with ccaps are also supposed to always be accessible to a specific level of member, then you need to add that ccap to that level’s capabilities.

In other words, if you want to see a ccap for a post that every level 2 member should be able to access without having to buy that ccap specifically, then you need to add that ccap to the level 2 capabilities. You would need a plugin like Capability Manager Enhanced to do that.

Another way of doing this is using a Payment Notification (see API/Notifications).
Create the desired URL like this:

http://www.example.com/checkout/?s2_payment_notification=yes&user-id=%%user_id%%

Then create a MU-Plugin (check the KB on how to do this), check if the new user has subscribed to a Level 2, and add the desired CCAP to his/her account details, like this:

$user_id = $_GET['user-id']; //This info comes from the URL
$user_id->add_cap('access_s2member_ccap_the-ccap-you-need');

This way you don’t need an extra plugin to handle the different capabilities manually in the wordpress dashboard, it is done automatically when they subscribe.

@Woohoo: Toon, yes, you can certainly do that, but I am not sure I agree with your characterization of the difference.

You say that “you don’t need an extra plugin to handle the different capabilities manually in the wordpress dashboard” to achieve this your way, but actually:

  1. You do need an extra plugin. Your method is just replacing a regular plugin with an mu-plugin. That’s fine, and it’s good that you posted this alternative, but it’s still a plugin.

  2. Yours is still a manual method. Every time a new ccap is created that an admin wants to add to an s2Member role, then it requires the manual addition of both a Payment Notification and another line in the mu-plugin.

Just to be clear, I’m not saying that there’s anything wrong with your method. I presume you prefer it, and so might many others. I just want to avoid creating a misleading impression that it makes everything automatic without the use of plugins. It would be great if it did, but it doesn’t.

Hi Tim,

You are right too!
The difference with my approach is that I, for the sake of the membership site I’m building, need to create CCAPS ‘on the fly’ without admin intervention.
These CCAPS are also applied to specific (dynamically created) pages, so user A with ccaps ‘ABC’ can only access the page that has CCAPS ‘ABC’.