Skip to content

Instantly share code, notes, and snippets.

@itsjusteileen
Last active October 3, 2018 09:47
Show Gist options
  • Save itsjusteileen/d922d56d3bbb8cf6e8f55b8f5a8f0943 to your computer and use it in GitHub Desktop.
Save itsjusteileen/d922d56d3bbb8cf6e8f55b8f5a8f0943 to your computer and use it in GitHub Desktop.
Paid Memberships Pro Sponsored/Group Members Set Up for One Level with Three Seats
<?php
/*
Plugin Name: PMPro Customizations
Plugin URI: https://www.paidmembershipspro.com/wp/pmpro-customizations/
Description: Customizations for my Paid Memberships Pro Setup
Version: .1
Author: Paid Memberships Pro
Author URI: https://www.paidmembershipspro.com
*/
//Now start placing your customization code below this line
/*
This snippet provides the controls for the Sponsored/Group Members Add On
Define the global array below for your main accounts and sponsored levels.
Array keys should be the main account level.
*/
global $pmprosm_sponsored_account_levels;
$pmprosm_sponsored_account_levels = array(
//set 3 seats at checkout for one level
1 => array( //the array key
'main_level_id' => 1, //the array key, the parent level/main account level
'sponsored_level_id' => 9, //child level
'seats' => 3
),
5 => array( //the array key
'main_level_id' => 5, //the array key, the parent level/main account level
'sponsored_level_id' => 10, //child level
'seats' => 3
),
6 => array( //the array key
'main_level_id' => 6, //the array key, the parent level/main account level
'sponsored_level_id' => 11, //child level
'seats' => 3
),
);
/*
This snippet hides a free level on the levels page
https://www.paidmembershipspro.com/hide-free-levels-from-the-membership-levels-page/
*/
function my_pmpro_levels_array($levels)
{
$newlevels = array();
foreach($levels as $level)
{
if(!pmpro_isLevelFree($level))
$newlevels[] = $level;
}
return $newlevels;
}
add_filter("pmpro_levels_array", "my_pmpro_levels_array");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment