How it Works

  • Admin designates a post as an “addon package” by setting a price for access and selecting which membership levels can purchase the package.
  • Once purchased the user will have access to the content as long as they have the required Membership Level.
  • For users without access, the page will show the excerpt and a link to purchase at the bottom of the page.
  • For users with access, the page will display the full post content (content after the “more” tag).
  • Set the global PMPROAP_EXP_DAYS to optionally define an expiration term for access to Addon Packages.
  • Use the filter pmproap_all_access_levels to define the level(s) that have “all access” as demonstrated in this companion tutorial.
  • Addon Packages only works for a one-time charge (no recurring payments on a single content purchase). You also cannot currently apply tax or discount codes to the addon package purchase.
Screenshot of the Add On Package Settings metabox on the Edit Post Screen
Screenshot of the Add On Package settings metabox on the Edit Post screen.
Example screenshot a user will see when trying to access a protected Add On Package page
Example screenshot a user will see when trying to access a protected Add On Package page.

This is a workaround if you would like to allow multiple membership levels per user.

Video Demo

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.

Membership and Addon Package Purchases

  • If the current user has already purchased the package, they will see a link to “View”.
  • If the current user has one of the valid memberships that can purchase the package, they can make the purchase without modifying their membership level.
  • If the current user does not have a membership level, does not have a level that is allowed to purchase this item, or if there is no current user (not logged in), they can click the “buy” button to purchase the correct membership and the package in one step.
  • If you don’t have any membership levels or want users to only pay the page price to view something, create a free membership level and select it.
  • If users from multiple membership levels (including non/free levels) can access a page, make sure you check all of the membership levels.

Linking to Checkout for an Addon Package

The plugin updates the text and links generated for non-members viewing a page with a price on it. If you wish to override this language, you can edit it or replace it using the pmpro_non_member_text_filterpmpro_not_logged_in_text_filter, and pmpro_rss_text_filter filters.

The way this plugin works is that you actually checkout for your current membership level again (or a new membership level if the user doesn’t have one yet) and the page price is added to your bill. The plugin makes sure you don’t pay the base membership level price twice and also makes sure your membership payment and expiration dates stay the same.

If you would like to link directly to the checkout page for a page, the URL structure is /membership-account/membership-checkout/?level={level_id}&ap={post_id} (Replace the parts in curly braces and make sure the page URL in front is correct for your checkout page.)

Configuration

Set the following optional filters, globals and constants in your site using your preferred method to make customizations to your membership site. Constants should be defined in the WordPress site’s wp-config.php file.

define( 'PMPROAP_EXP_DAYS', 0 );

Specify the global rule for when access to an Addon Package expires. Default: 0 (never expires). Set this to any integer to set a number of days from purchase when access should expire.


apply_filters( 'pmproap_all_access_levels', array(), $user_id, $post_id );

Optionally set an array of membership level IDs that have “All Access” to this Addon Package and do not need to complete a new purchase.


apply_filters( 'pmproap_text_level_id', $text_level_id, $post_id, $user_id, $post_levels );

Optionally set the membership level ID for new members completing purchase of this Addon Package. By default, the plugin’s code finds the first free membership level in the post’s required levels or the first paid level in the array of level IDs required.


apply_filters( 'pmproap_supported_post_types', array( 'page', 'post' ) );

Optionally adjust which post types support purchase as an Addon Package. The default for this plugin is posts and pages.


do_action( 'pmproap_action_add_to_package', $user_id, $post_id );

Hook to run custom logic after a user has completed the Addon Package purchase and gains access to the content.


do_action( 'pmproap_action_remove_from_package', $user_id, $post_id );

Hook to run custom logic after a user’s access has been removed from this Addon Package purchase and loses access to the content.


Using the pmpro_addon_packages Shortcode

The [pmpro_addon_packages] shortcode allows you to display a “shop” like page of available addon packages (all pages and posts with a defined pmproap_price). Just add the shortcode to a page with your desired attributes.

Shortcode Attributes

  • checkout_button: The text displayed on the button linking to checkout. (default: “Buy Now”).
  • exclude: A comma-separated list of the page IDs to exclude from display (default: none).
  • include: Optionally set this attribute to only show subpages of the active page. Accepts: “subpages”. (default: shows all pages and posts with an addon package price).
  • layout: The layout of the output. (default: table). Accepts “div”, “table”, “2col”, “3col”, “4col” (column-type layouts will work with the Memberlite Theme or any theme based on the Foundation 5 grid system).
  • link: Hyperlink the post/page title to the single view; accepts “true” or “false” (default: true).
  • orderby: Accepts any orderby parameter as defined in the codex. (default: menu_order).
  • order: Accepts ASC or DESC as defined in the codex. (default: ASC).
  • thumbnail: Optionally hide or show the subpage’s featured image; accepts “thumbnail”, “medium”, “large” or “false”. (default: thumbnail).
  • view_button: The text displayed on the button linking to view the single page. (default: “View Now”).

Screenshots and Code Examples

Four Column Layout

[pmpro_addon_packages layout="4col" orderby="post_title" thumbnail="thumbnail"]

Table Layout

[pmpro_addon_packages layout="table" orderby="post_title" thumbnail="thumbnail"]
Screenshot of the Add On Package 4 Columns Layout
Screenshot of the Add On Packages 4 Column Layout
Screenshot of the Add On Package Table Layout
Screenshot of the Add On Packages Table Layout

Using the pmproap_hasAccess Function

This function works similar to the pmpro_hasMembershipLevel function included in the core Paid Memberships Pro plugin. The function allows you to require the logged in member has purchased a specific Addon Package (by post ID). You can use the function to restrict content in a template file, custom plugin, or to build a custom web application.

You will need to know the $user_id of the user to check and the $post_id of the post to check. The function returns true if the user has access to the post, false if not.

All Access Levels

If you would like to define specific membership levels that have access to all Add-on Packages without requiring additional payment, us the pmproap_all_access_levels filter:

Limitations

Addon Packages only works for a one-time charge (no recurring payments on a single content purchase). You also cannot currently apply tax or discount codes to the addon package purchase.

Compatibility with Other PMPro Add Ons

This is a Plus Add On.

Plus Add Ons are included in all Plus or higher premium membership plans.