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_Access_Plan::calculate_redirection_url( $redirect_type )

Calculate redirection url from settings


Parameters Parameters

(string) (Required) The redirection type: self, page or url.


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/models/model.llms.access.plan.php

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
private function calculate_redirection_url( $redirect_type ) {
 
    $available = $this->is_available_to_user( get_current_user_id() );
 
    if ( ! $available && 'no' === $this->get( 'checkout_redirect_forced' ) ) {
        $redirect_type = 'membership';
    }
 
    // by default, no special redirection is needed.
    $redirection = '';
 
    switch ( $redirect_type ) {
 
        // redirect to itself.
        case 'self':
            /**
             * Only set up when it is a member's only access plan with forced redirection to course.
             * This will ensure that on a regular access plan, no special parameter is added to querystring.
             * At the same time, if it is a members' only access plan,
             * after membership checkout we'd like to force redirect to course
             */
            if ( ! $available && llms_parse_bool( $this->get( 'checkout_redirect_forced' ) ) ) {
                $redirection = get_permalink( $this->get( 'product_id' ) );
            }
            break;
 
        case 'page':
            $redirection = get_permalink( $this->get( 'checkout_redirect_page' ) );
            break;
 
        case 'url':
            $redirection = $this->get( 'checkout_redirect_url' );
            break;
 
    }
 
    return $redirection;
 
}


Top ↑

Changelog Changelog

Changelog
Version Description
3.30.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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