PMPro’s Sponsored Members Add On allows a member to purchase a block of linked accounts. When a primary “parent” member completes checkout, they receive a code to distribute to their team for use during registration.

When you start using this Add On for an existing membership site, the logic to generate sponsor codes only happens for new member checkouts based on your custom configuration.

If you would like existing members with a valid “parent” level to also receive a sponsor code, this is the code recipe you need.

The code recipe below allows you to auto-generate sponsor codes for existing members.

Banner Image for Generate Sponsor Codes for Existing Members Code Recipe

About the Code Recipe

This code recipe is useful for sites that want to begin using the features of Sponsored Members and have existing members that qualify for child accounts.

When an existing member logs in to your site, the code recipe checks whether or not the member meets the following criteria:

Screenshots showing members table before and after existing member logging in for sponsor code

If these conditions are met, the sponsor code will be automatically generated on the fly. (Note that this code recipe doesn’t create all the sponsor codes as a bulk process, it runs “on the fly” as the existing members log into your site).

The Code Recipe (PHP)

Adding the Recipe to Your Website

You can add this recipe 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.

Free Course: Membership Site Development—The Basics

Develop a deeper understanding of membership site development in this beginner-level course. Learn how to make your site work better, save yourself time and money, and improve your site's performance.

Featured Image for Membership Site Development Course: The Basics
Was this article helpful?
YesNo