Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
LLMS_REST_Access_Plans_Controller::unset_subordinate_props( array $to_set, array $saved_props )
Remove all the properties that do not need to be set, based on other properties
Parameters Parameters
- $to_set
-
(array) (Required) Array of properties to be set.
- $saved_props
-
(array) (Required) Array of LLMS_Access_Plan properties as saved in the db.
Return Return
(void)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-access-plans-controller.php
// No need to create/update recurring props when it's a 1-time payment. if ( 0 === $props['frequency'] ) { unset( $to_set['length'], $to_set['period'] ); } // No need to create/update trial props when no trial enabled. if ( ! llms_parse_bool( $props['trial_offer'] ) ) { unset( $to_set['trial_price'], $to_set['trial_length'], $to_set['trial_period'] ); } // No need to create/update sale props when not on sale. if ( ! llms_parse_bool( $props['on_sale'] ) ) { unset( $to_set['sale_price'], $to_set['sale_end'], $to_set['sale_start'] ); } // Unset redirect props based on redirect settings. if ( 'url' === $props['checkout_redirect_type'] ) { unset( $to_set['checkout_redirect_page'] ); } elseif ( 'page' === $props['checkout_redirect_type'] ) { unset( $to_set['checkout_redirect_url'] ); } else { unset( $to_set['checkout_redirect_url'], $to_set['checkout_redirect_page'] ); } // Unset expiration props based on expiration settings. if ( 'lifetime' === $props['access_expiration'] ) { unset( $to_set['access_expires'], $to_set['access_length'], $to_set['access_period'] ); } elseif ( 'limited-date' === $props['access_expiration'] ) { unset( $to_set['access_length'], $to_set['access_period'] ); } elseif ( 'limited-period' === $props['access_expiration'] ) { unset( $to_set['access_expires'] ); } } /** * Check if the current user, who has no permissions to manipulate the access plan post, can edit its related product. * * @since 1.0.0-beta.18
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.18 | Introduced. |