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.


Top ↑

Return Return

(boolean|WP_Error) Returns true on success or an error object.


Top ↑

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;
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.