The current version of Paid Memberships Pro only allows users to have One Membership Level Per User at a time.
If a member checks out for a different membership level, their previous level is cancelled (any attached recurring subscriptions are cancelled) and they are given the new level.
Having just one level per user makes sense for a certain kind of membership site where different levels are basically upgrades or downgrades around one featured product. This is the user case PMPro was initially developed for.
However, some sites would benefit from allowing their users to purchase multiple membership levels at the same time or over time to add additional subscriptions to their one WP user account. The clearest example of this is an E-Learning type site where each membership level corresponds to a “course” on the site with users able to purchase one or more courses concurrently.
This is not about a new version of Paid Memberships Pro.
Work to allow users to purchase multiple memberships was started in 2013,
but we have sidelined that work until further notice and a very alpha version of Multiple Memberships Per User as an Add On is now live on a few sites..
This post is about the different ways to work around having multiple memberships per user with the current version of Paid Memberships Pro.
Work Around 1: Use the Addon Packages Plugin
If you only need to support one time payments for access to each course/package/level/whatever, then you can use the Addon Packages plugin in lieu of regular membership levels.
The basic steps to use PMPro Addon Packages for multiple membership levels would be:
- Setup a free membership level or paid “base” level for your members.
- Create a basic WordPress page for each course/level/package/etc.
- Enter the one time price for each page in the PMPro Addon Packages settings for the pages.
- Direct customers to the page which will have a link to checkout for the addon package.
- To lock down related content use the pmproap_hasAccess($user_id, $post_id) function in your code to check if $user_id has purchased access to $post_id.
This post describes how to sync Paid Memberships Pro with WP Courseware using Addon Packages with a page setup for each course. (This works independent of the official PMPro for WP Courseware bridge plugin.)
Work Around 2: Adding Fields to Checkout
Instead of having a separate membership level for each offering, you can have one main membership level (or a few based on other factors) and add a checkbox or other field to checkout for members to opt into each course or individual offering.
You can add fields using the PMPro Register Helper plugin API and then use code like this to adjust the price of your level at checkout based on the values of the fields:
Then you can use code like the following to check for the user meta value set by that field when handling access.
With a little bit of programming, you could even automate parts of this. Here is the outline of a nifty plugin to automate some of this:
- Add at least one core membership level.
- Add additional membership levels to be used as “options” at checkout for the main level. Mark the level as hidden.
- Use code to lookup all hidden levels (or a specific set of level ids) to create a PMPro Register Helper field at checkout for the main level.
- Upon checkout, adjust the cost of the main level based on the cost of the hidden option levels checked at checkout.
- Hook into the pmpro_has_membership_level filter to look if a user has the corresponding user meta for the field specified vs actually being a member of that level in PMPro.
- Similarly, hook into the pmpro_has_membership_access_filter filter to check those user meta fields in addition to the values in the pmpro_memberships_users table.
Many other addons or bits of code may still be confused about what “levels” a member has when for instance figuring out which mailing lists to subscribe a member to. And you might have to tweak some more code to handling these cases based on your setup. (This is why adding this functionality to core is so hard.) But this is the gist of how you can go about allowing multiple membership levels on a specific setup.
Work Around 3: Setup a Multisite Network
When running Paid Memberships Pro on a multisite network, each blog/site that PMPro activated on will have its own set of levels and members. So users in the network can have a membership on site A and a different membership on site B.
In some cases it might make sense to simply setup a new site for each membership offering rather than putting multiple offerings on the same WordPress site.
Setting up and running a multisite network is not always an easy thing to do. So if you don’t have other reasons for wanting to go with multisite, you might want to avoid doing this only to be able to offering multiple memberships.