Skip to content

Instantly share code, notes, and snippets.

@actual-saurabh
Created December 11, 2019 06:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save actual-saurabh/16444bcc9e8ce349630955afdd7b1883 to your computer and use it in GitHub Desktop.
Save actual-saurabh/16444bcc9e8ce349630955afdd7b1883 to your computer and use it in GitHub Desktop.
Access Plans Upgrade/Downgrade
<?php
// hide system access plans from pricing table and course/membership editor
add_filter( 'llms_get_product_access_plans_args', 'llms_custom_hide_system_access_plans_args' );
function llms_custom_hide_system_access_plans_args ( $args, $product, $free_only, $visible_only ) {
if( isset( $args['tax_query'] ) ) {
$args['tax_query'][0]['terms'][] = 'system';
} else {
$args['tax_query'] = array(
array(
'field' => 'name',
'operator' => 'NOT IN',
'terms' => array( 'system' ),
'taxonomy' => 'llms_access_plan_visibility',
),
);
}
return $args;
}
// Remove the limitation to the total number of Access Plans possible.
add_filter( 'llms_get_product_access_plan_limit', 'llms_custom_unlimited_access_plans' );
function llms_custom_unlimited_access_plans() {
return -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment