How It Works

Claimed Gift CodesThe Gift Membership Add On adds “gift levels” to Paid Memberships Pro by defining “gift giver” and “gift recipient” level relationships with customized gift levels. When a user’s membership level is changed to the designated “gift giver” level, a customized discount code is created based on the settings set in the $pmprogl_gift_levels global array. Additionally, any levels can be set to require gift codes by using the $pmprogl_require_gift_code global array.

Any user who has purchased Gift Codes will be able to view their claimed and unclaimed codes on their Membership Account page.

Note: Checking out with a “gift giver” level will not change that user’s membership level if they already have one, so members are free to purchase as many Gift Codes as they desire.


Installation

  1. Upload the ‘pmpro-gift-levels’ directory to the ‘/wp-content/plugins/’ directory of your site.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Create a membership level for “gift giver” and a level for “gift recipient”.

Customizing with Your Settings

Add the following settings to a Plugin for PMPro Customizations:

$pmprogl_gift_levels

A global array to define giver-recipient level relationships and customize the gift levels.

$pmprogl_require_gift_code

(Optional) A global array to require gift codes for specified levels.


Using $pmprogl_gift_levels

$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:

level_id Membership Level ID of the gift membership level. This can be found by going to Memberships > Membership Levels in the WordPress Dashboard.
initial_payment The initial payment for the gift membership level.
billing_amount The recurring billing amount for the gift membership level.
cycle_number The number of billing cycles for the gift membership level.
cycle_period The billing cycle period. Possible values are “Day”, “Week”, “Month”, and “Year” (without the quotes).
billing_limit The billing cycle limit for the gift membership level.
trial_amount The trial amount for the gift membership level.
trial_limit The number of cycles the trial should last for the gift membership level.
expiration_number The number of “experiation_period”s before the gift membership level expires.
expiration_period The duration of the period used by “expiration_number”. Possible values are “Day”, “Week”, “Month”, and “Year” (without the quotes).

Gift Codes


Using $pmprogl_require_gift_code

The $pmprogl_require_gift_code global variable is an array of membership level IDs which defines which membership levels should require a discount code at checkout

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