Table of contents

Written by:
Martin Barrett
Last Updated:
MemberPress Shortcodes

All you Need to Know about Available MemberPress Shortcodes

MemberPress is a learning management system (LMS), paywall, subscription, community, and subscription plugin. It makes it simple to turn your WordPress website into an online business.

The system uses shortcodes to generate content and learn from your site’s traffic. To learn more about shortcodes and the ones you can use on your WordPress page, read our comprehensive guide on MemberPress shortcodes.

What Are Shortcodes?

In your WordPress page and post content, shortcodes are tiny placeholders that you may place just about anywhere.

These placeholders are analyzed and replaced with some dynamically generated content when a visitor views the page.

For instance, you might have a shortcode that displays the user’s first name who is presently signed in. For example, [mepr-account-info field=”first name”] may be a shortcode.

When Jane Smith, a user who is logged in, views the page that the shortcode is on, where that shortcode has been added, Jane will appear in the content of the page.

Types Of Shortcodes

On WordPress, two types of shortcodes can be used:

  • Self-closing shortcodes – These are shortcodes that don’t need a closing tag. For example, the “gallery” shortcode on WordPress doesn’t require a closing tag, because you add everything it needs with different attributes.
  • Enclosing shortcodes – These shortcodes need a closing tag. They often manipulate the content between the closing and opening tags. For example, the “caption” shortcode on WordPress is used to wrap a caption around content. While it’s mostly used for images, it can be used with any HTML element.

A Brief History Of Shortcodes

The first online forum software to popularize shortcodes was Ultimate Bulletin Board (UBB). They created BBCode (Bulletin Board Code) in 1998, a set of simple tags that users could use to structure their messages.

BBCode is a lightweight markup language that functions similarly to HTML but is much easier to use.

Predefined tags are also significantly safer because users can’t add HTML code and cause security flaws. For instance, a user intending harm could utilize the script tag to run JavaScript code and obstruct the functionality of the website.

Soon after, BBCode functionality was extended to the message boards of other online forum software, including phpBB, XMB Forum, and vBulletin.

Shortcodes gave administrators more authority to restrict what their users could do. Additionally, they provided simple tags that users might utilize to format their text.

Default WordPress Shortcodes

Without MemberPress, or any other plugin, WordPress comes with six default shortcodes. These are:

  • caption – Allows you to wrap captions around your content and works with any HTML element.
  • audio –  Allows you to embed audio files on your website with simple playback controls.
  • embed – Expands on the default oEmbed feature, allowing you to set different attributes for your embeds.
  • gallery – Allows you to insert a simple image gallery on your website. Using attributes, you can define images and customize the gallery with this shortcode.
  • video – Allows you to embed a video file with a simple video player. This shortcode supports mp4, webm, m4v, webm, ogv, wmv, and flv formats.
  • playlist – Allows you to display audio and video files in a playlist.

MemberPress Account Shortcodes

[mepr-account-link]

Displays a link to MemberPress’s Account page. It is suitable for any page or post.

  • [mepr-account-form]

Shows the user account information form. Unless you want to display account information someplace other than the MemberPress Account page that is present by default, this is normally not used.

People that utilize WPML and make distinct account pages for each language may find this handy as well.

  • [mepr-logout-link] or [mepr-login-link]

Both of these shortcodes are the same. Depending on whether the user is currently logged in or out, they display links for logging in or out.

The user can log in on the MemberPress login page by clicking the login link. The user will be logged out and directed to the Logout Redirect URL you specified on your MemberPress Settings page when they click the logout link.

  • [mepr-list-subscriptions status=”all”]

Lists all active and inactive subscriptions for the current user.

Since MemberPress 1.9.28, we’ve added a status attribute that is optional. The default current’s active and inactive subscriptions will be displayed when you remove status, as in the example below: [mepr-list-subscriptions] or set it to “all,” as you can see above.

When status is set to “active,” you enter the code: [mepr-list-subscriptions status=”active”] then you will see the active subscriptions of the current users.

Using the “expired” status, you may also see a user’s inactive subscriptions: [mepr-list-subscriptions status=”expired”].

  • [mepr-login-form use_redirect=”true”]

Displays a login form on a post or page. It is applicable everywhere.

Use redirect will direct users to the login redirect URL setting on the MemberPress Settings page if it is set to true.

  • [mepr-user-active-membership-titles userid=”” message=””]

Shows the names of the members that are currently active.

The current member will be used by default if there is no userid specified. The names will be separated by commas if the member has several current memberships.

There is now an optional message attribute in MemberPress as of version 1.9.38. When a user has no current subscriptions, you may use it to display a specific message.

The shortcode will not display any message if you leave it blank.

  • [mepr-user-file slug=”mepr_slug” user_id=””]Link Text[/mepr-user-file] 

Displays a URL so that you can read or download the user’s uploaded file. The slug of the custom field from your MemberPress > Settings > Fields tab should be substituted for mepr slug.

The file for the user who is now logged in will be displayed if user id is left out; otherwise, the file for the user you specified by user id will be displayed.

The ending shortcode tag is optional, but if you do, any content that appears in that space will be utilized as the file’s link text.

  • [mepr-account-info field=”slug”]

Shows the user meta field, which is chosen by “slug”.

Slugs

Slugs
  • full_name

“Jane Smith”

  • full_name_last_first

“Smith, Jane”

  • last_name_first_initial

“Smith, J.”

  • first_name_last_initial

“Jane S.”

  • first_name

“Jane”

  • last_name

“Smith”

  • user_email

“janesmith12345@email.com”

  • user_login

“janesmith”

  • nickname

“janesmith”

  • display_name

“janesmith”

  • ID

The distinctive ID given to the user at registration. You must type “ID” rather than “id.”

  • description

States biographical information about the user.

  • mepr-address-one

“123 Road Street”

  • mepr-address-two

“Apt. 123”

  • mepr-address-city

“Seattle”

  • mepr-address-state

“Washington”

  • mepr-address-zip

“12345”

  • mepr-address-country

“USA”

  • user_registered

Shows date and time the user first joined.

  • mepr_user_message

The “Custom MemberPress Account Message” you have defined for the member in their profile.

MemberPress Registration Shortcodes

  • [mepr-group-price-boxes group_id=”123″]

If you want to add material above and below the group pricing boxes, this will be useful.

There is no need to include a group id if you’re utilizing this directly on the Group page. It must have the group id attribute on it if you wish to use it elsewhere on your website.

  • [mepr-membership-link id=”0″]Link text in here[/mepr-membership-link]

Displays the link to the Membership, identified by “id.”

  • [mepr-membership-access-url id=”123″]Link text here[/mepr-membership-access-url]

Use the Membership access URL specified in the Membership Options section’s “Membership access URL” parameter.

To provide the member with a link to the Membership access URL, use this anywhere on your website.

“id = 123” should be replaced with the ID of your Membership.

  • [mepr-membership-registration-form]

Used to place content above and below the Membership registration form, but can only be used on the Membership page.

  • [mepr-membership-registration-form id=”123″]

This shortcode can be used to display a specific membership registration page, post, or custom post type. Simply swap out “123” for the unique ID associated with your membership.

In order to prevent mistakes from showing up on the form while utilizing this, you’ll likely need to additionally select the Global CSS option in your MemberPress > Settings > General tab.

  • [mepr-offline-instructions gateway_id=”abc-123″]Custom message here.[/mepr-offline-instructions]

Use this shortcode to display any message tailored to users who registered using your offline gateway option on your “thank you” pages.

Enter your gateway’s ID in the field gateway id=”abc-123″. When people buy your membership using your offline gateway, it could be used to give them additional instructions.

Even though it was created with offline gateways in mind, any other MemberPress enabled gateway’s gateway ID can be used with it to the same effect.

  • [mepr-ecommerce-tracking]Message with %%variables%% in here[/mepr-ecommerce-tracking]

Only the thank you page or customized thank you page messages may utilize this shortcode. It is ineffective elsewhere.

The following variables are supported; values from the purchase are automatically substituted for them.

Variables

  • %%subtotal%%

Generates the first payment’s subtotal.

This will be 0.00 if the initial payment was a free trial period. This will be the subtotal of the trial period payment if the initial payment was for a paid trial period.

  • %%total%%

Generates the first payment’s subtotal plus tax.

This will be 0.00 if the initial payment was a free trial period. This will be the sum of the trial payment if the initial payment was a paid trial period.

  • %%tax_amount%%

Generates the initial payment’s tax amount.

This will be 0.00 if the initial payment was a free trial period. It will be the tax amount of the initial payment, if it was a paid trial.

  • %%tax_rate%%

Outputs the user’s tax rate on the purchase.

  • %%sub_id%%

Generates the ID of the recurring subscription.

This variable will not be replaced if the purchase made is not recurring.

  • %%sub_num%%

Outputs the recurring subscription’s Subscription Number.

This variable won’t be changed if the transaction is not recurring.

It may take some time for the gateway to refresh the record with a legitimate subscription number when using PayPal Standard, therefore MemberPress may generate a temporary number in this case.

  • %%%txn_id%%

Gives the first transaction’s ID.

This ID for recurring subscriptions is typically the ID for the hidden grace period.

  • %txn_num%%

Provides the first payment’s Transaction Number.

Since the payment gateway takes some time to execute the first payment for recurring payments, this transaction number will probably be a temporary one generated by MemberPress.

  • %%membership_amount%%

Generates the recurring subscription fee in its regular amount.

This variable won’t be changed if the transaction is not recurring.

  • %%trial_amount%%

Outputs the fee for a trial period of a recurring subscription.

This variable won’t be changed if the transaction is not recurring.

  • %%trial_days%%

Provides the length of a recurring subscription’s trial period, whether it is free or paid.

This variable won’t be changed if the transaction is not recurring.

  • %%user_email%%

Outputs the member’s email.

  • %%user_id%%

Outputs the member’s User ID.

  • %%username%%

Outputs the member’s username.

It will output the user’s email address if you have configured the MemberPress Settings to make the user’s email address the same as their username.

  • %%membership_name%%

Outputs the name of the Membership purchased.

  • %%membership_id%%

Outputs the ID of the Membership purchased.

MemberPress Unauthorized Access Shortcodes

MemberPress Unauthorized Access Shortcodes
  • [mepr-active {parameters}]Content to protect in here[/mepr-active]

Used to show or conceal content on various pages across your website according to given parameters.

  • [mepr-unauthorized-message]

Wherever this is inserted, the unauthorized message is displayed.

It is advised to use this shortcode on the unauthorized page if MemberPress is configured to send unauthorized visitors to a certain URL.

  • [mepr-show]Content to show in here[/mepr-show] or [mepr-hide]Content to hide in here[/mepr-hide]

The if=”X” attribute, which supports either “loggedin” or “loggedout,” is supported by both shortcodes.

It makes no difference what, if any, Memberships the user has purchased because both shortcodes operate regardless of whether the user is signed in or out.

Instances of this include: when “logged in,” [mepr-show] You’ve successfully logged in! [/mepr-show]. When “logged out,” [mepr-show] You have been logged out! [/mepr-show].

Parameters

Here, parameters marked with a * are required, and parameters marked with a ** mean they are required and only one of these can be applied per shortcode.

  • rules(s)**

Set this to rule=”X” if you only intend to use one Rule ID.

Set this to rules=”X, XX, XXX” if you intend to use multiple Rule IDs, where X’s are the Rule IDs.

  • membership(s)**

Set this to membership=”X” if you only intend to utilize one Membership ID.

Set this to memberships=”X, XX, XXX” if you intend to use multiple membership IDs, with X’s denoting the Membership IDs.

  • ifallowed*

The content in-between is only visible to authorized members when set to ifallowed=”show”.

When ifallowed=”hide” is used, the content is only visible to approved members.

  • unauth

The user will see the unauthorized message if unauth=”message” is set and they are not authorized.

The user will see the login form if unauth=”login” is set, even if they are not permitted.

The user will see the default unauthorized message and login form if unauth=”both” is specified.

When “message” or “both” is selected and the rule has a custom unauthorized message, the custom unauthorized message will be displayed in place of the global one.

  • unauth_message

You can use this to replace the pre-installed unauthorized message.

Only when “message” or “both” are selected as the value for the “unauth” attribute above does this apply.

Benefits And Drawbacks Of Using Shortcodes

Pros

  • Shortcodes may be incorporated into plugins. The shortcodes will remain valid and continue to function as they did before, regardless of whether you upgrade WordPress or modify/update your theme.
  • Shortcodes are made simple to use across numerous WordPress websites by being bundled inside plugins. A developer managing many sites will find it quite helpful to have all of their custom shortcodes available.
  • Since shortcodes can also receive attributes, users can change how a shortcode behaves by simply changing the settings for its attributes.
  • Shortcodes automate the process of developing software. They do away with the requirement to build intricate scripts each time you wish to insert a specific functionality.
  • Shortcodes make it easier to add sophisticated features to WordPress websites. A single line of code can be used to add practically anything.
  • When compared to inserting HTML code or PHP scripts, shortcodes are more user-friendly.

Cons

  • If you switch themes, shortcodes that are included with the new theme will no longer function.
  • In terms of grammar, shortcodes are unclear. Some of them, for instance, allow optional closing, allowing you to use them as self-closing, enclosing, or even both if they are nested. You can see how things could quickly get really confusing.
  • The end user finds shortcodes difficult to utilize, especially if there are several of them on a website. They are better suitable for developers in these circumstances.
  • Due to incompatibilities or tag conflicts, shortcodes have the potential to damage HTML. They are never a pleasant sight to behold on the front end of any website.
  • Shortcodes increase the server burden. This load grows as there are more shortcodes on your page/posts. Your website may slow to a crawl if you use too many shortcodes.
  • Simply looking at a shortcode doesn’t always reveal what it performs. 

To Conclude

MemberPress has many shortcodes you can use to improve your WordPress website and increase your understanding of your users while optimizing the user interface. With this guide, you’ll be able to utilize shortcodes easily and effectively.

Tips & Guides
Udemy and Skillshare have been among the top online learning platforms and marketplaces where professionals can become content creators and...
Tips & Guides
Skillshare is an awesome online learning platform, they have thousands of online courses available for you to use and learn...
Tips & Guides
While Skillshare has over 18,000 online classes to push your creativity, you may decide that you wish to delete your...
Course
Are you looking for a masterclass marketing course that will cover everything you need? Then this article is going to...
Course
Are you interested in pursuing online learning? This style of education can be massively beneficial since students have increased flexibility...