How it Works

Allow anyone to purchase a gift of membership. When a user purchases a membership level that is set up as a “Gift Level”, a customized discount code is created after checkout. The gift code can be claimed for a free membership, with an appropriate expiration date if configured, for the level selected in the Gift Level’s settings.

  • Users who purchase gifts will not be given a membership level in your site.
  • Gift purchasers can log in as a user and view the history of purchases made, available gift codes, and claimed gift codes.
  • Users can purchase as many gift codes as they want.

Installation | Membership Level Settings | Email Template Settings | Advanced Setup

Installation

  1. Plus and Unlimited members can install the Add On via the Memberships > Add Ons page in the WordPress admin.
  2. Or, download the plugin file and upload the pmpro-gift-levels directory to the /wp-content/plugins/ directory of your site.
  3. Activate the plugin through the Plugins menu in WordPress.
  4. Navigate to Memberships > Settings > Levels to create and manage gift membership levels.
  5. Navigate to Memberships > Settings > Email Templates to modify default messages sent through this plugin.

Membership Level Settings

Navigate to Memberships > Settings > Levels to create a new “Gift Level” and configure additional settings. Below is a list of the additional fields shown on the Edit Level page when using this Add On.

  • Gift Level?: Check this box if you would like to set the membership level being edited as a gift level
  • Level to Gift: Choose the membership level that a discount code should be created for when this gift level is purchased
  • Allow Gift Emails: Check this box to allow customers to enter the recipient email address at checkout. If an email address is provided, the recipient will automatically receive an email containing a personalized message and a link to claim the gift code. You can customize the “Gift Recipient” template on the Memberships > Settings > Email Templates page in the WordPress admin.
  • Gift Membership Expires: If left unchecked, the gifted membership will never expire.
  • Gift Expiration Period: The length of time until a gifted membership will expire once redeemed.

For example, let’s say your membership site sells a $10 monthly membership called “Premium”. Using the Gift Membership Add On, you could create a level called “Gift of Premium” that entitles the recipient to 6 months of Premium membership.

You would set a $60 initial payment on the “Gift of Premium” membership. Then, in the “Gift Membership” settings, assign the “Level to Gift” as “Premium” with a “Gift Expiration Period” of 6 months.

Gift Membership edit membership level settings for customizing the gift level
Edit membership level settings for customizing the gift level
Gift Membership checkout page screenshot with recipient information fields
Checkout page screenshot with recipient information fields

Email Template Settings

The Gift Membership plugin adds three new email templates that you can use to modify the default messages sent as part of a gift purchase:

  • Gift Recipient: This email is sent when the gift giver provides the recipient email address at checkout.
  • Gift Purchased: This email is sent to the gift giver as confirmation of their purchase after checkout.
  • Gift Purchased (admin): This email is sent to the admin as confirmation of gift purchase after checkout.

The default Gift Purchased email includes a “Gift Confirmation Message” for the membership level that was purchased. This message includes a link to checkout and claim the gift code generated through the purchase.

If you would like to overwrite any Gift Membership-related email, navigate to Memberships > Settings > Email Templates. Below is a list of additional template variables you can use to customize message:

  • !!pmprogl_giver_display_name!!: The display name of the user that purchased the gift of membership.
  • !!pmprogl_gift_message!!: The personalized message the gift giver added at checkout, if available.
  • !!pmprogl_gift_code!!: The gift code (discount code) generated for this purchase
  • !!pmprogl_gift_code_url!!: A full URL to the membership checkout page for the gifted level that automatically applies the gift code.

Advanced Setup

In addition to the membership level settings for Gift Memberships, this Add On can also be set up by defining “gift giver” and “gift recipient” level relationships using PHP.

Developers can add this setup code to your site by creating a custom plugin or using the Code Snippets plugin available for free in the WordPress repository. Read this companion article for step-by-step directions on either method.

If the $pmprogl_gift_levels array is set up in PHP, it will overwrite the settings defined in the WordPress admin.

$pmprogl_gift_levels is an associative array containing arrays where the “gift giver” membership level IDs are keys, with the values being an array of discount code options for the gift level. Here are the available options explained in more detail:

Option NameOption Description
level_idMembership Level ID of the gift membership level. This can be found by going to Memberships > Membership Levels in the WordPress Dashboard.
initial_paymentThe initial payment for the gift membership level.
billing_amountThe recurring billing amount for the gift membership level.
cycle_numberThe number of billing cycles for the gift membership level.
cycle_periodThe billing cycle period. Possible values are “Day”, “Week”, “Month”, and “Year” (without the quotes).
billing_limitThe billing cycle limit for the gift membership level.
trial_amountThe trial amount for the gift membership level.
trial_limitThe number of cycles the trial should last for the gift membership level.
expiration_numberThe number of “experiation_period”s before the gift membership level expires.
expiration_periodThe duration of the period used by “expiration_number”. Possible values are “Day”, “Week”, “Month”, and “Year” (without the quotes).

$pmprogl_require_gift_code is a global variable containing an array of membership level IDs. This array specifies which membership levels should require a discount code at checkout.

// Make levels 2 and 4 require a discount code at checkout.
$pmprogl_require_gift_code = array(2,4);

Note: a user who has purchased gift codes can not use their own gift codes if the gift level is in this array.

Complete Example

Below is a full code example of using the (optional) PHP method to define the settings for this Add On

If you want to use custom code but would also like to allow gift delivery at checkout, please follow the one-time steps below to enable “Gift Recipient” emails. This is only required if you want to continue using the custom PHP method to define your Gift Membership settings.

  1. Edit the Membership Level that you would like to enable this functionality for.
  2. Check the “Gift Level?” box.
  3. Check the “Allow Gift Emails” box.
  4. Then, uncheck the “Gift Level?” box.
  5. Save the Membership Level.

At this time there is no other way to allow customers to enter the recipient email address at checkout via custom code.