Paid Memberships Pro emails a membership invoice for all recurring or renewing membership subscriptions. This email is not sent after the initial membership checkout because all of the relevant invoice details are included in the Membership Confirmation email. If you’ve customized the Confirmation email and removed invoice details, you may want to send a separate invoice email using the recipe below.
I’ve been asked this simple question many times recently: “How do I display the current user’s membership level in my theme?”
This post details how to use the
[pmpro_member] shortcode, included in the main plugin, to show specific information about the current logged in user’s membership.
Why would you want to do this?
We created the
[pmpro_member] shortcode so that you can build a more robust and personalized experience on your membership site.
How to use the shortcode:
You can place this general shortcode anywhere in your site, either in post content or widgets, or via template files using the WordPress
Available shortcode attributes:
The shortcode accepts one single parameter, with a specific set of values as listed below. These values will pull the data directly from the current logged in user record.
Supported “field” Values Include:
Fields Stored in the
Learn more about General Shortcodes in Paid Memberships Pro »
Many development and staging sites want to restrict total access to the site’s folder on the webserver. One of the easiest ways to do this is by setting a UNIX password at the server level.
This advanced developer recipe shows you how to set up custom
.htaccess rules to allow your Webhook or IPN data through this security measure. This will allow you to properly configure and test payment gateways in Paid Memberships Pro.
About the Recipe
If your site has a UNIX password or is in Coming Soon/Maintenance Mode, your gateway will not be able to get to your site and send their data.
The recipe below will allow any of the listed IP addresses access to your website and will prompt everyone else to enter your secret UNIX username and password.
Note that this recipe specifically allows the IP addresses of the PayPal IPN Live Server and the Stripe Webhook. If you are using another gateway or using PayPal in Sandbox mode you will need a separate list of IP addresses. Please consult your payment gateway documentation to locate their active IP addresses.
- Stripe Domains and IP Addresses
- Authorize.Net Domains and IP Addresses
- PayPal IP Addresses for Live Servers
- PayPal IP Addresses for Sandbox Servers
- PayPal IP Addresses for Payflow Servers
- Braintree IP Addresses
- 2Checkout: Secure Webhooks
This recipe will only work with sites restricted by a UNIX password. If you are using a Coming Soon plugin, you’ll need to take another approach to allow gateway access to your site (the easiest method is to disable the maintenance mode while running your tests). We’ll try to put together a similar recipe for popular plugins with this feature, or you can open topic in the members-only support forum for personal help.
The Code Recipe
While most membership sites we work with offer a rolling membership, many sites operate with a specific renewal schedule. Our Subscription Delays Add On adds a “delay” field to your membership levels and discount codes, allowing you to set a variable-length period between the member checkout and the subscription payment start date.
Read on to explore some popular applications of this logic.
How to: Calendar Year Membership
The most common reason sites would like all members to renew on the same date is for a calendar-year membership (from January 1 to December 31). Members can sign up any time within the year, pay the initial payment (if applicable), and then have their active subscription begin on the 1st of January the following year.
To do this: set the “Delay” field on the “Edit Membership Level” page to
How to: Membership Starts on the First of the Month
Another common application of the Subscription Delays Add On is for Monthly Memberships where all members renew on the 1st of the month. Members can sign up any time within the current month, pay the initial payment (if applicable), and then have their active subscription begin on the 1st of the following month.
To do this: set the “Delay” field on the “Edit Membership Level” page to
How to: Membership Starts on a Specific Date
If you’re running a course or group membership that kicks off on a specific date, you can use the Subscription Delays Add On to activate every member’s subscription on the same date. Members can sign up any time prior to the activation date, pay the initial payment (if applicable), and then have their active subscription begin on your specific date.
To do this: set the “Delay” field on the “Edit Membership Level” page to the format
2019-03-15 for the 15 March 2019.
The video below will walk through how to use these examples for your membership site.
But wait, there’s more!
This Add On can also allow variable-length trials.
It’s a limitation of most payment gateways that you can only set a trial period equal to your subscription period (i.e. a monthly subscription can only offer a month-long trial). Sites can now offer a unique trial period using this Add On, such as:
- Set a 30-day trial on an annual membership level by setting the “Delay” field to
- Set a 1 week trial on a monthly membership level by setting the “Delay” field to
If you’re using widgets on your WordPress site and want to customize them for members and non-members, check out the recipes below. We’ll provide a way to filter an entire widget area for members-only, as well as a recipe to hide a specific widget instance based on the current user’s membership level.
Hide an Entire Widget Area
The following recipe allows you to define dynamic sidebars (by sidebar ID) to hide or show based on the membership requirements of the active post ID. Any widgets placed in the filtered widget areas will not show if the current user does not have access to the post ID.
Hide a Specific Widget Instance
The following recipe allows you to hide specific widget instances (regardless of the widget area they are placed in) based on the current user’s membership level. This code recipe can be extended for several membership level checks based on your needs.
Page builders are a popular way to create a more visually appealing user experience on your site. Many Paid Memberships Pro users are confused with how to properly use these tools alongside the required shortcodes on various pages of your membership site, such as the pricing page or membership account page.
Below are a list of common issues we see when trying to use Paid Memberships Pro with a page builder.
Required page shortcodes don’t render.
The main issue that we see related to Page Builders is that default page shortcodes, such as
[pmpro_account], don’t render. You’ll know you are experiencing this issue if you go through the Initial Plugin Setup, then click to view your “Membership Pricing” page and see something like this:
Not all of the Paid Memberships Pro shortcodes will render as actual content when using a live editing experience. I have seen different behavior among all of the builders I tested. The best way to ensure the page is loading properly is to save and publish your content then view the page on the frontend.
If the shortcode still isn’t rendering, make sure you are using your builder’s standard text or shortcode widget/component/block for the page’s required shortcode. I have seen cases where the builder places your page’s shortcode in a special block type that will not render shortcodes. Here’s a list of all required shortcodes for your Membership pages.
“Live Editors” don’t load or redirect to the “Membership Levels” page.
This issue is present if you try to edit a page like the “Membership Account” page in a “Live Editor” experience, but the editor redirects you to the Membership Levels page. To resolve this, you must make sure that your administrator account has a membership level. This is due to a conflict where the builder is trying to offer a “preview” of the page, while our membership plugin is trying to restrict your access to these members-only pages. Having a membership level on your administrator account (even you create a hidden, private level that only your Admin account has) resolves this.
Members-only content isn’t protected.
Because Page Builders rely heavily on their own logic to render page layouts, sometimes the builder’s content filters run later than the Paid Memberships Pro filter. This can result in protected content being public. The solution to this issue has been covered previously in this article, which outlines how to run the Paid Memberships Pro content filters with a higher priority (after the builder has done its content-formatting magic).
Alternately, you can use this method to redirect non-members away from members-only content. This completely bypasses the need to filter members-only content and is the most straightforward approach to tackling this issue.
“Live Editor” on the checkout page doesn’t load.
The Membership Checkout page relies on a level ID being passed through the URL (usually from the Membership Levels page) in order to display the appropriate level details at checkout. When using a live preview or editor experience, there is no level ID passed in the URL so the page either fails to load or redirects to the Membership Levels page. You can resolve this by adding a Custom Field with the key or name
pmpro_default_leveland value of any valid level ID. This allows the “Live Editor” to locate a level for the preview page. Now your Membership Checkout page’s live editor can draw in some level’s content and allow the preview.
I don’t see the “Restrict Membership” box on the editor.
If your page builder uses a live editing format, chances are that the “Restrict Membership” metabox is not part of this editing experience. After you have made your page design and content changes via your builder’s editor, you will need to also edit the post with the WordPress editor and select the appropriate membership levels to restrict access. Read this guide for more help on restricting content using Paid Memberships Pro.
All of the above issues have a solution, so please don’t panic. We are looking for ways to build support into our plugin for popular open source page builders. For now, we’ve tested Paid Memberships Pro compatibility with the list of Page Builders below. These were tested on a fresh WordPress site with only the core Paid Memberships Pro plugin, the Twenty Sixteen WordPress Theme and using only that specific Page Builder. If you are using another open source page builder, please post a comment below and we will test which combination of solutions are needed to make the two plugins compatible.
Page Builder by SiteOrigin
This builder is one of the most popular open source builders available via the WordPress.org Repository. In my testing, I have found that you need to modify a few of the ways our core plugin renders content in order to ensure compatibility with SiteOrigin’s builder. The code recipe below should be included in a plugin for PMPro Customizations.
In this recipe, we are removing some content filters we add to your site’s level descriptions and confirmation messages, as they were causing issues when the builder attempted to render the membership checkout and confirmation page shortcodes.
When editing the Membership Checkout page, you must set a Custom Field on the Membership Checkout page with the key
pmpro_default_level and value of any valid level ID. This allows the “Live Editor” to locate a level for the preview page.
You must also make sure that your administrator account has a membership level in order to use the “Live Editor” experience. This is due to the fact that the Page Builder by SiteOrigin editor is trying to offer you a “preview” of the page, while our membership plugin is trying to restrict your access to these members-only pages. Having a membership level on your administrator account (even you create a hidden, private level that only your Admin account has) resolves this.
This builder is gaining popularity very quickly and its easy to see why. Because Elementor is a drag & drop live editor, there are some special considerations you need to make specifically when attempting to use the builder to edit your Membership Checkout page. When editing the Membership Checkout page, you must set a Custom Field on the Membership Checkout page with the key
pmpro_default_level and value of any valid level ID. This allows the live preview editor to locate a level for the preview page. This step must be done before you convert to editing the page with the live preview.
You must also make sure that your administrator account has a membership level in order to use the “Edit with Elementor” experience. This is due to the fact that the Elementor editor is trying to offer you a “preview” of the page, while our membership plugin is trying to restrict your access to these members-only pages. Having a membership level on your administrator account (even you create a hidden, private level that only your Admin account has) resolves this.
You must also add a custom code recipe that filters your content later as well as removes the default content filters our plugin uses on your site’s level description and confirmation messages. The code recipe below should be included in a plugin for PMPro Customizations.
Beaver Builder offers a live editing experience for WordPress and premium versions offer pre-built templates and layouts which make it simple to design well thought out content. In my testing it was one of the most intuitive builders in this list. There are a few steps to take to ensure compatibility with Beaver Builder. The code recipe below should be included in a plugin for PMPro Customizations.
When editing the Membership Checkout page, you must first set a Custom Field with the key
pmpro_default_level and value of any valid level ID. This step must be done before you convert to editing the page with Beaver Builder. This allows the live preview editor to locate a level for the preview page.
You must also make sure that your administrator account has a membership level in order to use the live editor experience. This is due to the fact that the Beaver Builder editor is trying to offer you a “preview” of the page, while our membership plugin is trying to restrict your access to these members-only pages. Having a membership level on your administrator account (even you create a hidden, private level that only your Admin account has) resolves this.
You must also add a custom code recipe that filters your content later. This allows Beaver Builder to process all the layout-related filters on your content, then allows Paid Memberships Pro to apply appropriate membership restrictions. The code recipe below should be included in a plugin for PMPro Customizations.
More about Page Builder Compatibility
I have also seen some funny behavior specifically if you had generated the PMPro pages prior to activating the Page Builder. If your builder isn’t playing nicely with our shortcodes, try to open the page in the builder’s editor then save the page. For some reason this occasionally resolves the issue and then your shortcode will render.
- Edit each Page under Memberships > Page Settings.
- Swap to your builder’s rich page editing experience.
- Make sure the appropriate page’s shortcode is in the editor.
- Save the page.
Using another Page Builder?
If we didn’t cover the builder you are using or if you have Page Builder-like features as part of your theme, post a comment below and we will try to test it and work out a solution. We are only able to offer compatibility testing if the builder you are using is also open source, like Paid Memberships Pro and the page builders mentioned in this post.
This post recaps the Paid Memberships Pro Add Ons recently updated. Plus or Unlimited members can upgrade through their WordPress dashboard under Dashboard > Updates or Memberships > Add Ons. Be sure to backup your site before performing updates.
Our BuddyPress Integration Add On allows you to manage access to your BuddyPress Community using Paid Memberships Pro. v1.1 and v1.1.1 resolve several bugs and offer enhancements as listed below:
- BUG FIX: Fixed fatal errors when PMPro or BuddyPress isn’t activated.
- BUG FIX: Fixed bug where membership level changes were creatinig fatal errors if Groups was not active.
- BUG FIX: Fixed bug where the members directory was not being filtered correctly.
- BUG FIX: Fixed bug where logged in users were being redirected to the BuddyPress registration page even though logged in users can’t register.
- ENHANCEMENT: Doublechecking pmpro_hasMembershipLevel so plugins like PMPro Approvals can still filter which levels are included when calculating restrictions.
If you’d like to capture the member’s name and address fields for a free membership level or if you are using an offsite payment gateway, check out this Add On.
v.3.3 fixes an issue where name fields weren’t updating WordPress when PayPal Express was used.
This Add On adds the ‘Require Membership’ meta box to all CPTs selected and redirects non-members to the selected page.
v.2.1 of the Add On fixes a bug with redirects when no CPTs were selected on the settings page but the is_singular check was still returning true. This resulted in ALL single content posts and pages being redirected.
This plugin will help to manage grouped discount codes or large numbers of unique discount codes with the same pricing.
v.3.1 and v.3.2 of the plugin add features related to viewing individual group code activity. The release adds a “Group Code Uses” column to the Memberships > Discount Codes page. This column will now show a sum of child codes that have been used. The release also adds a “Group Code” column to the Memberships > Orders CSV export.
This Add On adds a “delay” field to membership levels and discount codes, allowing you to set a variable-length period between your initial payment (if required) and recurring subscription payment.
v.4.6 of the Add On fixes a bug where an invalid startdate was returned from pmpro_profile_start_date filter handler. This resulted in double payments at checkout for levels that had no subscription delay set.
This plugin aggregates several features for integrating your Membership site with WooCommerce to sell Memberships as a product, set a global % discount on products by level or set a per-product members-only price. Several updates have been made to the Add On through v1.6.1, including:
- BUG FIX: Fixed fatal error in
pmprowoo_get_membership_products_from_order()that was happening on some systems.
- ENHANCEMENT: Localization/GlotPress support.
- BUG FIX: Fixed bug when deselecting the autocomplete option on a membership product.
- BUG FIX: Now checking if a user has a different subscription linked to their membership level before removing a user’s membership level. Users switching between subscriptions for the same level would have their level removed. (Thanks, Ted Barnett)
- BUG FIX: Fixed issues when a product with a sale price also has membership pricing.
- BUG FIX/ENHANCEMENT: Updated to work with the latest versions of WooCommerce (3.4.2) and WooCommerce Subscriptions (2.2.22).
- ENHANCEMENT: Added a filter
pmprowoo_get_membership_price, which can be used to support variable products via custom code (like this)
- ENHANCEMENT: Added support for PMPro Multiple Memberships per User.
Advanced Custom Fields is a popular plugin available in the WordPress.org Plugin Repository. The plugin allows you to add structured information to your posts, pages, and more.
This guide explains three primary methods to hide or show fields based on the membership requirements for the post.
Option 1: The
Since the ACF plugin requires you to add custom PHP functions to your theme’s template files, one of the easiest ways to restrict the display of fields is to wrap your entire display in the
pmpro_hasMembershipLevel() function. Here’s an example of using the function in your template files:
You can read full documentation on the
pmpro_hasMembershipLevel() function here.
Option 2: The
Similar to the option above, this method will look to the post’s required membership levels. You won’t need to specify the level IDs when using this function, it will inherit the membership protection from the “Require Membership” metabox for that post. Here’s an example of using the function in your template files:
Option 3: The
If you’re using version 5+ of the Advanced Custom Fields plugin, you can write a single function that will filter all fields on a member-protected page. This code will uses the
acf/format_value filter to check first if the user has access to the post and will then optionally restrict the display of the field.
Note that this will not restrict the display of any custom HTML you have in your page templates, but it is a simple solution that won’t require editing all of your theme files.
This code will add an “Exclude my profile from the member directory” field at membership checkout when using the Member Directory and Profile Pages Add On for Paid Memberships Pro.
About the Recipe
The Member Directory and Profile Page Add On includes functionality to allow members to remove their profile from display. This field is added by default as a field on the user’s WordPress Profile. The recipe below adds that field at membership checkout (note that this recipe requires the Register Helper Add On).