How it Works

Allow members and users to view information about their Membership in a card-like format via the website or print. The card displays specific user and membership data as defined by shortcode attributes and can be extended with custom code.

  • You can display one or more of the user’s membership levels on the card (v1.0+ is compatible with the Multiple Memberships Per User Add On).
  • Info on the card can be customized by shortcode attributes (documented below).
  • You can add an icon or logo to the card for personalization.
  • The card can display a scannable QR Code, which you can update via a filter to adjust what data is returned by the QR code.
  • Members will see a link to view their Membership Card from the “Member Links” section of the Membership Account page.
  • Users will see a link to view their Membership Card on the “Edit Profile” page.
Sample Membership Card for PMPro

Installation

You must have the Paid Memberships Pro plugin installed and activated with a valid license type to use this Add On.

  1. Navigate to Memberships > Add Ons in the WordPress admin.
  2. Locate the Add On and click “Install Now”.
    • To install this plugin manually, download the .zip file above, then upload the compressed directory via the Plugins > Add New > Upload Plugin screen in the WordPress admin.
  3. Activate the plugin through the Plugins screen in the WordPress admin.

Create a page and add the shortcode pmpro_membership_card.

(Optional) Customize your card by adjusting shortcode attributes, setting a featured image or creating a custom template.

Video Demo

Using the Shortcode

The plugin adds a new shortcode which assigns a page as the Membership Card page. The page containing the shortcode will display the membership card and a link to print the membership card.

Shortcode attributes include:

  • print_size: Specify what sizes to include in the “print” view; Default: all; Accepts: “small”, “medium”, “large” and/or “all”.
  • qr_code: Optionally display a QR code on the card. Default: “false”; Accepts: “true” or “false”.
  • qr_data: Specify what data the scanned QR code should return. Default: “ID”; Accepts: “email”, “ID”, “level” or “other”.
    • If set to “other”, you must leverage the pmpro_membership_card_qr_data_other filter hook to set the value.
    • If you return values that could contain special characters, note that you must properly filter the return value. For example, if you are returning data in JSON format, consider returning the value using code like: return json_encode( $return_value, JSON_UNESCAPED_UNICODE );

If Paid Memberships Pro is activated, only members will be able to view the membership card. If not, the card will show for all WP users.

Adding an Image to the Card

Metabox to Set the Featured Image on the Page in WordPress

You can add an icon or logo to the card by setting a “Featured Image” on the page that displays your membership card. Please follow this WordPress guide for adding a featured image to a page. You can also optionally show the user avatar on the card using the code recipe provided in this tutorial.

Custom Template for the Membership Card

If you need to deeply customize the Membership Card in a way that shortcode attributes, custom CSS, or provided action and filter hooks allow, you will need to create a custom template for the card. You can create your own custom Membership Card format and load it via a specific location in your theme. Copy the file located at: /pmpro-membership-card/templates/membership-card.php to your active theme directory in this exact location: .../themes/my-theme/membership-card.php. This will load your custom template in place of the default template.

Action and Filter Hooks

apply_filters( 'pmpro_membership_card_since_date', string $since_date );

The default behavior will show the “user_registered” date (the date the user registered for the site).


do_action( 'pmpro_membership_card_after_card' );

Hook to show additional content via a custom function.


apply_filters( 'pmpro_membership_card_qr_code_size', string $size );

The default QR code value is set to “125×125”.


apply_filters( 'pmpro_membership_card_qr_data_other', object $pmpro_membership_card_user, string $option );

Allows you to show custom information when the shortcode’s qr_data attribute is set to ‘other’.

This is a Standard Add On.

Standard Add Ons are included in all premium membership plans.