LLMS_Order_Generator::validate_plan()
Validates the access plan.
Description Description
Ensures the access plan data was submitted and that it’s a valid plan.
Return Return
(boolean|WP_Error) Returns true
on success or an error object.
Source Source
File: includes/class-llms-order-generator.php
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 | protected function validate_plan() { $plan_id = $this ->data[ 'llms_plan_id' ] ?? null; if ( ! $plan_id ) { return $this ->error( self::E_PLAN_REQUIRED, __( 'Missing access plan ID.' , 'lifterlms' ) ); } $plan = llms_get_post( $plan_id ); if ( ! $plan || 'llms_access_plan' !== $plan ->get( 'type' ) ) { return $this ->error( self::E_PLAN_NOT_FOUND, __( 'Access plan not found.' , 'lifterlms' ) ); } $this ->plan = $plan ; return true; } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
7.0.0 | Introduced. |