Scripting - Custom Capabilities / Packages
Packaging Together Custom Capabilities w/ Membership
Using one of optimizeMember's Payment Button and/or Form Generators, you can add Custom Capabilities in comma-delimited format. optimizeMember builds upon existing functionality offered by WordPress Roles/Capabilities. optimizeMember supports Free Subscribers ( at Level #0 ), and several Primary Roles created by the optimizeMember plugin ( i.e. optimizeMember Levels 1-4, or up to the number of configured Levels ). Each optimizeMember Level ( aka: optimizeMember Role ) provides the Capability current_user_can("access_optimizemember_level0"), 1, 2, 3, 4, where access_optimizemember_level[0-4] is the Capability associated with each Role; and Membership Levels provide incremental access ( i.e. Level #4 Members can also access content at Levels 0, 1, 2, and 3 beneath them ). In short, these Level-based permissions are the default Capabilities that come with each Membership Level being sold on your site.
Now, if you'd like to package together some variations of each Membership Level that you're selling, you can! All you do is addCustom Capabilities whenever you create your Payment Button and/or Form Shortcode ( there is a field in the Button & Form Generators where you can enter Custom Capabilities ). You can sell Membership Packages that come with Custom Capabilities, and even with custom prices.
Custom Capabilities are an extension to a feature that already exists in WordPress. The current_user_can() function, can be used to test for these additional Capabilities that you allow. Whenever a Member completes the checkout process, after having purchased a Membership from you ( one that included Custom Capabilities ), optimizeMember will add those Custom Capabilities to the account for that specific Member.
Custom Capabilities are always prepended with access_optimizemember_ccap_. You fill in the last part, with ONLY lowercase alpha-numerics and/or underscores. For example, let's say you want to sell Membership Level #1, as is. But, you also want to sell a slight variation of Membership Level #1, that includes the ability to access the Music & Video sections of your site. So, instead of selling this additional access under a whole new Membership Level, you could just sell a modified version of Membership Level #1. Add the the Custom Capabilities: music,videos. Once a Member has these Capabilities, you can test for these Capabilities using current_user_can("access_optimizemember_ccap_music") and current_user_can("access_optimizemember_ccap_videos").
The important thing to realize, is that Custom Capabilities, are just that. They're custom. optimizeMember only deals with the default Capabilities that it uses. If you start using Custom Capabilities, you MUST use Simple or Advanced Conditionals ( i.e. current_user_can() logic ) to test for them. Either in your theme files with PHP, or in Posts/Pages using Simple Conditionals( powered by Shortcodes ).
*New* In the latest versions of optimizeMember, you can automatically require certain Custom Capabilities on a per Post/Page basis. So now, optimizeMember ( if you prefer ) CAN handle Custom Capabilities for you automatically! Whenever you edit a Post/Page ( i.e. there is a Meta Box for optimizeMember in your Post/Page editing station )... you can tell optimizeMember to require certain Custom Capabilities that you type in, using comma-delimited format. In other words, you will need to type in some of the trigger words that you used whenever you created your Payment Buttons/Forms. This way paying Members will have the Custom Capabilities to view different kinds of content that you offer.
*New* By default, a Checkout Button or Form generated by optimizeMember is designed to (Add) Custom Capabilities to any that may or may not already exist for a particular User/Member. However, starting with optimizeMember v110815+, you can tell optimizeMember to (Remove All) Custom Capabilities, and then (Add) only the new ones that you specify. This is accomplished on a per Form/Button basis by preceding your comma-delimited list of Custom Capabilities with `-all`. For further details on this topic, click the [?] icon next to the Custom Capabilities field in any Button/Form Generator supplied by optimizeMember.
*New* Independent Custom Capabilities. You can now sell one or more Custom Capabilities using Buy Now functionality, to "existing" Users/Members, regardless of which Membership Level they have on your site ( i.e. you could even sell Independent Custom Capabilities to Users at Membership Level #0, normally referred to as Free Subscribers, if you like ). So this is quite flexible. For further details, please check your Dashboard, under: optimizeMember -> PayPal Buttons -> Capability (Buy Now) Buttons.