Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Custom Capabilities as Product Identifiers #202

Open
2 of 6 tasks
raamdev opened this issue Apr 29, 2015 · 6 comments
Open
2 of 6 tasks

Using Custom Capabilities as Product Identifiers #202

raamdev opened this issue Apr 29, 2015 · 6 comments

Comments

@raamdev
Copy link
Contributor

raamdev commented Apr 29, 2015


KB Article Creation Checklist
  • Write initial draft for this KB Article; label this issue draft and either questions or tutorials
  • Add required YAML configuration
  • Add Tags for this KB Article to the YAML config (see YAML Keys (Explained))
  • Edit and finalize draft for publishing (remove draft label, add draft-finalized label)
  • Assign Issue to yourself and create Markdown file (remove draft-finalized label, add pending)
  • Project Lead: Review and Publish KB Article (remove pending label, add published label)
Additional TODOs

Additional TODO list items go here.

title: Using Custom Capabilities as Product Identifiers
categories: tutorials
tags: 
author: raamdev
github-issue: https://github.com/websharks/s2member-kb/issues/202

Using Custom Capabilities as Product Identifiers

Custom Capabilities can be used to restrict access to specific content, however they can also be used as simple identifiers for products or types of memberships. Using Custom Capabilities in this way allows you to make use of existing s2Member functions to create conditionals on your pages that change what is shown to a logged-in member based on the variation of the product they purchased.

Example: Monthly and Yearly Subscription Plans

If you use a single membership level (e.g., Level 1) but offer two different subscription options, e.g., yearly and monthly, you can use Custom Capabilities to identify which users signed up with the monthly plan and which users signed up with the yearly plan by adding a Custom Capability to the Pro-Form shortcode.

In the following example, we have a Pro-Form with two Checkout Options, one for a yearly subscription and one for a monthly subscription. Note the ccaps="" shortcode attribute indicating yearly vs monthly:

[s2Member-Pro-PayPal-Form ps="paypal" lc="" cc="USD" dg="0" ns="1" custom="example.com" ta="0" tp="0" tt="D" ra="5" rp="1" rt="M" rr="1" rrt="" rra="2" accept="paypal" accept_via_paypal="paypal" coupon="" accept_coupons="0" default_country_code="" captcha="0" ]
     [s2Member-Pro-PayPal-Form level="1" ccaps="monthly" desc="$5 USD / Monthly (recurring charge, for ongoing access)" /]
     [s2Member-Pro-PayPal-Form level="1" ccaps="yearly" desc="$60 USD / Yearly (recurring charge, for ongoing access)" /]
[/s2Member-Pro-PayPal-Form]

2015-05-01_08-01-19

See also:

  • Dashboard → s2Member → PayPal Pro-Forms → Wrapping Multiple Shortcodes as 'Checkout Options'
  • Dashboard → s2Member → PayPal Pro-Forms → Shortcode Attributes (Explained))

When a user signs up with one of the Pro-Forms that contains a Custom Capability (ccaps=""), you'll see the Custom Capability associated with their account listed in the Custom Capabilities column on the Users list, allowing you to easily see who signed up for the Monthly plan and who signed up for the Yearly plan:

2015-05-01_08-08-48

You could then use this information to customize how various content on your site is presented to users who signed up for the Monthly vs Yearly subscription.

For example, on your Login Welcome Page you could make use of conditionals to check the Custom Capability of the user who just logged in and then show specific content to them:

[s2If current_user_can(access_s2member_ccap_monthly)]
   You are on a monthly plan.
[/s2If]
[s2If current_user_can(access_s2member_ccap_yearly)]
   You are on a yearly plan.
[/s2If]

Or, a more complex/reliable conditional check would be:

[s2If current_user_can(access_s2member_ccap_monthly)]
  You are on a monthly plan.
  [else]
  [_s2If current_user_can(access_s2member_ccap_yearly)]
     You are on a yearly plan.
  [/_s2If]
[/s2If]
@jaswrks
Copy link
Contributor

jaswrks commented Apr 30, 2015

This is a great idea for an article. Walking through some examples, like showing how we use "pro,unlimited" might help fill this out a bit. It really shows how you can exploit CCAPS in ways that we really haven't covered in any KB articles yet.

@raamdev
Copy link
Contributor Author

raamdev commented May 1, 2015

Worked on this a bit and added the section Using Custom Capabilities as Product Identifiers and Example: Monthly and Yearly Subscription Plans.

@raamdev
Copy link
Contributor Author

raamdev commented May 1, 2015

I'm thinking this should probably be a tutorial, with the question summarizing and linking to the tutorial.

@jaswrks
Copy link
Contributor

jaswrks commented May 1, 2015

I'm thinking this should probably be a tutorial, with the question summarizing and linking to the tutorial.

Agree :-) Nice work on this!


  • I added a couple of contextual links above. "Custom Capabilities" and "conditionals" are now linked to articles that go over those topics in greater detail.

It might be a good idea to include a quick example that shows how to convey this to a user. For instance, on your Login Welcome Page you could present something like this...

[s2If current_user_can(access_s2member_ccap_monthly)]
   You are on a monthly plan.
[/s2If]
[s2If current_user_can(access_s2member_ccap_yearly)]
   You are on a yearly plan.
[/s2If]

Or, a more complex/reliable conditional check would be:

[s2If current_user_can(access_s2member_ccap_monthly)]
  You are on a monthly plan.
  [else]
  [_s2If current_user_can(access_s2member_ccap_yearly)]
     You are on a yearly plan.
  [/_s2If]
[/s2If]

@raamdev
Copy link
Contributor Author

raamdev commented May 2, 2015

I added a couple of contextual links above.

Great! Thank you!

It might be a good idea to include a quick example that shows how to convey this to a user.

Great idea! I updated the draft to include these examples.

@raamdev raamdev changed the title How can I differentiate between monthly and yearly subscribers? Using Custom Capabilities as Product Identifiers May 2, 2015
@raamdev
Copy link
Contributor Author

raamdev commented May 2, 2015

Renaming this GitHub issue to Using Custom Capabilities as Product Identifiers and making it a Tutorial; I'll create a new KB Article for the Question How can I differentiate between monthly and yearly subscribers? and reference this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants