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
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. |