Created
December 11, 2019 06:20
-
-
Save actual-saurabh/16444bcc9e8ce349630955afdd7b1883 to your computer and use it in GitHub Desktop.
Access Plans Upgrade/Downgrade
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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