Insert a “Renew Membership” button via custom shortcode to display a renewal link/button for members.

The code recipe below to creates a renewal button shortcode [pmpro_renew_button] that can be used to insert a “Renew Membership” button on your WordPress site.

This page requires a Plus Account or higher.


Already have an account?

Log In

New to this site?

Register Now

Using the [pmpro_member] Shortcode to display current member information.

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 do_shortcode() function.


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.

[pmpro_member field="membership_name"]

Supported “field” Values Include:

Membership Level Fields:
  • membership_id
  • membership_name
  • membership_code_id
  • membership_code
  • membership_initial_payment
  • membership_billing_amount
  • membership_cycle_number
  • membership_cycle_period
  • membership_billing_limit
  • membership_trial_amount
  • membership_trial_limit
  • membership_startdate
  • membership_enddate

Fields Stored in the users table
  • user_login
  • user_email
  • user_url
  • user_registered
  • display_name

Payment Fields Stored in user_meta:
  • bfirstname
  • blastname
  • baddress1
  • baddress2
  • bcity
  • bstate
  • bzipcode
  • bcountry
  • bphone
  • bemail
  • CardType
  • AccountNumber
  • ExpirationMonth
  • ExpirationYear


Learn more about General Shortcodes in Paid Memberships Pro »

New [haspaid] Shortcode: Show Content to Paying (or not paying) Members Only

Jason just coded up a new shortcode feature for a support customer and we wanted to share it—hooray open source! It’s a little tricky to explain, but once you wrap your brain around the features, you’ll begin to think of interesting ways to apply it to your membership site.

The shortcode is primarily useful for sites that offer free trials and want to show (or hide) content to users who are on the trial vs. those that are full paying members.

has paid Shortcode for Paid Memberships Pro WordPress Plugin


A little more detail…

The “haspaid” shortcode detailed below looks up a member’s order history and checks whether their current level or any past levels have a positive order total value. Then, using the shortcode attributes, you can show or hide content only to members that match your criteria.

For example, the image above shows an upgrade message to members on a free trial of level ID 1 that have NEVER paid for the level. This is the shortcode and content used to create that callout.

If you’re using the Memberlite Theme, you can use the [memberlite_btn] shortcode like this:

[memberlite_btn style="action" href="/membership-checkout/?level=1" text="Upgrade to Gold Membership" icon="heart"]

Members of level ID 1 that are paying (full members) will not see this callout or any interruption in the standard content of your page/post.

Another example may be to wrap the [haspaid] shortcode inside of the [membership] shortcode to show an upgrade notice to members who USED to be a higher tier and are now a lower tier. For example:


Shortcode Attributes

  • paid: Accepts ‘true’ (has paid) or ‘false’ (hasn’t paid); default: true
  • level: The level ID to check against. Accepts any level ID; default: none.

Shortcode Examples

[haspaid]
This will show up if the user has paid for any level.
[/haspaid]
[haspaid paid='0']
This will show up if the user has NOT paid for any level.
[/haspaid]
[haspaid paid='1' level='1']
This will show up if the user has paid for level 1 specifically.
[/haspaid]
[haspaid paid='0' level='1']
This will show up if the user has not paid for level 1 specifically.
[/haspaid]

The Code Recipe

This code recipe requires a PMPro Plus Account or higher.

View Membership Options

Using Paid Memberships Pro Shortcodes in Widgets

pmpro-do_shortcodeIf you want to use a Paid Memberships Pro shortcode in a widget, your theme must declare support for shortcodes in widget_text.

This page requires a Plus Account or higher.


Already have an account?

Log In

New to this site?

Register Now