There are a few scenarios possible with this Add On. Each scenario shares these common features:
- When users checkout for a main account (or are assigned one by and admin), a discount code is generated to allow sponsored members to sign up for the sponsored level for free.
- If a user has a discount code assigned to them, it will show up on their membership account and confirmation pages.
- Sponsored members will be linked to their sponsor through the
pmpro_discount_codes_uses
table. - If a sponsor’s account is cancelled, all of their sponsored members will have their accounts disabled as well.
- If a sponsor’s account is reenabled at a later point, all of their sponsored members will have their accounts reenabled automatically.
- Sponsors (parents) cannot use their own code to checkout for membership.
Table of contents
- Video Demo
- Popular Use Cases Include
- Setting up the $pmprosm_sponsored_account_levels Array
- Child Accounts Without Email Addresses
- Creating Sponsored Accounts at Checkout
- Sample $pmprosm_sponsored_account_levels Array
- Importing Members with Sponsored Parent to Child Relationships
- Screenshots
- Action and Filter Hooks
Video Demo
Popular Use Cases Include
- Parent account completes checkout and receives a discount code with a specified number of uses (seats) to share with child accounts, who can register their own account at the specified level for charge.
- Parent account selects the additional number of child accounts they would like to purchase at a specified price (N accounts * X price per account is added to parent’s price for membership). Parent account receives a discount code with the selected number of uses (seats) to share with child accounts, who can register their own account at the specified level for charge.
- Parent account selects the number of child accounts they would like to purchase at checkout, then fills in account information for each child account. After successfully checking out, parent and child accounts are created and ready to use.
Installation
You must have the Paid Memberships Pro plugin installed and activated with a valid license type to use this Add On.
- Navigate to Memberships > Add Ons in the WordPress admin.
- 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.
- Activate the plugin through the Plugins screen in the WordPress admin.
Setting up the $pmprosm_sponsored_account_levels
Array
This Add On must be configured via custom code in your helper PMPro Customizations plugin. You must declare a global $pmprosm_sponsored_account_levels
array.
Required general array parameters:
main_level_id
: The membership level ID for the primary or parent level; the ID must match the index. Accepts: any integer.sponsored_level_id
: The membership level ID of the sponsored level(s); Accepts: a single integer or an array of integers.add_code_to_confirmation_email
: Whether the code for sponsored levels should be added to the confirmation email sent to the original member after checkout. Accepts: ‘true’ or ‘false’.
Seat Cost and Billing
apply_seat_cost_to_initial_payment
: The seat cost of each individual sponsored membership will be applied to the initial payment the original member pays at time of registration. Accepts: ‘true’ or ‘false’.apply_seat_cost_to_billing_amount
: The seat cost of each individual sponsored membership will be applied to the recurring payment of the original member. Accepts: ‘true’ or ‘false’. You can set both theapply_seat_cost_to_initial_payment
andapply_seat_cost_to_billing_amount
values to ‘true’ to have the seat cost charged immediately at checkout and for each recurring billing payment. (i.e. 5 seats at $10 per month will charge $50 at initial checkout and $50 per 1 month)seat_cost
: The cost of each sponsored member, in dollars. If you want the sponsored memberships to be free, setseat_cost
to 0 or omit the array value. This array value is required for the “Additional Seats” checkout field to display. Accepts any integer.seat_cost_text
: Optionally specify custom text for the content shown below the seat selection dropdown. If not specified, your field will show the following default text: “+x per extra seat.“, where x is the value set forseat_cost
in this array.seats
: The number of sponsored accounts that should be generated for the main account. Omit theseats
array value from the array if you want the parent member to choose the number of seats at checkout.max_seats
: The maximum number of sponsored members a parent account can request at checkout. This value is required for the “Additional Seats” checkout field to display. Accepts: any integer.min_seats
: The minimum number of sponsored members a parent account can request at checkout. Ifmin_seats
isn’t defined, the minimum number of seats will default to 1. Accepts: any integer.discount_code
: An associative array containing the details of the discount code that sponsored members will use to register (see example).
Note: max_seats
and seat_cost
must both be set to add the “Additional Seats” checkout field.
Other Optional Parameters
discount_code_required
: Optionally set this parameter totrue
to force a discount code or sponsor code be used at membership checkout for thesponsored_level_id
.hide_display_discount_code
: Optionally set this parameter to true if you don’t want sponsors to be able to see their sponsor code.
Child Accounts Without Email Addresses
Just like every WordPress user account, every child account must also have a unique email address. In some rare cases, you may have members that want to sign up a sponsored or child account that does not have their own email address. The current workaround that WordPress and Paid Memberships Pro support is the following method:
Append a plus (“+”) sign and any combination of words or numbers after your email address name (before the @ symbol). For example, if your email address is [email protected]
, you could instruct members to sign up their child accounts using an email address like [email protected]
or [email protected]
.
Note this may not work with every email service, but we do know that this works with GMail.
Creating Sponsored Accounts at Checkout
sponsored_accounts_at_checkout
: Should the original member enter the details for sponsored members at checkout? Accepts: ‘true’ or ‘false’. Defaults to false. If set to false, the original member will be given discount codes after checkout and the sponsored members will enter their own information during member registration.sponsored_header_text
: Optionally modify the default text shown in the section where child accounts can be created. If not specified, your checkout form will show the following default text: “Please fill in following information and account(s) will be created.”
Note: The following fields only apply if sponsored_accounts_at_checkout
is set to true
and you have defined the max_seats
and seat_cost
values. These options are still in development. If you receive a “required field” warning at checkout the options you have set are not currently compatible and will be updated in a future release.
You will need to write custom code to support generating child email, username, and password if you set these options to hide the fields at checkout.
children_get_name
: If set to true, will ask for a first and last name for the sponsored account(s) created at checkout. Accepts: ‘true’ or ‘false’.children_hide_username
: Hide the username field for sponsored account(s) created at checkout. Accepts: ‘true’ or ‘false’.children_hide_password
: Hide the password field for sponsored account(s) created at checkout. Accepts: ‘true’ or ‘false’.
Sample $pmprosm_sponsored_account_levels
Array
Importing Members with Sponsored Parent to Child Relationships
Assuming your Sponsored Members Add On is properly configured, you can leverage the Import Users from CSV Add On to import existing members with a parent to child relationship by following the steps below.
Note that before importing child accounts, you must first import your parent accounts. The import relies on an existing parent account’s User ID, Email Address, or unique User Login.
- Make sure you have properly configured the
$pmprosm_sponsored_account_levels
global array. - In addition to the required columns as outlined in the Import Users from CSV Add On documentation, you must add the following columns to your CSV import file:
pmprosm_seats
: This will set the user meta field that stores the number of seats available to a sponsoring/parent account. Leave blank or 0 for unlimited. This field should only be imported for a “Parent” account type.pmprosm_sponsor
: Set this field to the User ID, Email Address, or User Login for the Sponsor or Parent Account for this user. If the account is a “Parent” account type, leave this field blank.
- Complete the import according to the steps outlined in the Import Users from CSV Add On documentation.
Screenshots
Action and Filter Hooks
apply_filters( 'pmprosm_sponsored_code_settings', array('code' => $code, 'starts' => $starts, 'expires' => $expires, 'uses' => $uses ) );
This is a Plus Add On.
Plus Add Ons are included in all Plus or higher premium membership plans.