LLMS_Access_Plan::get_redirection_url( bool $encode = true, bool $querystring_only = false )

Retrieve the full URL to redirect to after successful checkout.


Parameters Parameters

$encode

(bool) (Optional) Whether or not encoding the URL.

Default value: true

$querystring_only

(bool) (Optional) Only return the redirect URL bassed by the querystring.

Default value: false


Top ↑

Return Return

(string)


Top ↑

Source Source

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

	public function get_redirection_url( $encode = true, $querystring_only = false ) {

		// What type of redirection is set up by user?
		$redirect_type = $this->get( 'checkout_redirect_type' );

		// Force redirect querystring parameter over all else.
		$redirection = llms_filter_input( INPUT_GET, 'redirect', FILTER_VALIDATE_URL ) ?? '';

		if ( ! $redirection && ! $querystring_only ) {
			$redirection = $this->calculate_redirection_url( $redirect_type );
		}

		/**
		 * Filter the checkout redirection parameter.
		 *
		 * @since 3.30.0
		 * @since 7.0.0 Added `$querystring_only` parameter.
		 *
		 * @param string            $redirection      The calculated url to redirect to.
		 * @param string            $redirection_type Available redirection types 'self', 'membership', 'page', 'url' or a custom type.
		 * @param LLMS_Acccess_Plan $access_plan      Current Access Plan object.
		 * @param bool              $querystring_only Whether or not it was requested to only return the redirect URL passed by querystring.
		 */
		$redirection = apply_filters( 'llms_plan_get_checkout_redirection', $redirection, $redirect_type, $this, $querystring_only );

		return $encode ? urlencode( $redirection ) : $redirection;

	}



Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Addeded $encode and $querystring_only parameters.
3.30.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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