Closure::redirect( $user_id,  $closure_data,  $recipe_id,  $args )


Parameters Parameters

$user_id

(Required)

$closure_data

(Required)

$recipe_id

(Required)

$args

(Required)


Source Source

File: src/core/lib/recipe-parts/trait-closures.php

	public function redirect( $user_id, $closure_data, $recipe_id, $args ) {

		$redirect_url = isset( $closure_data['meta'][ $this->get_closure_meta() ] ) ? $closure_data['meta'][ $this->get_closure_meta() ] : '';
		if ( empty( $redirect_url ) ) {
			return;
		}
		$redirect_url = Automator()->parse->url( $redirect_url, $recipe_id, $args );
		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
			update_option( 'UO_REDIRECTURL_' . $user_id, $redirect_url );
		} else {
			?>
			<script type="text/javascript">
				let t = setTimeout(function () {
					document.location.href = '<?php echo esc_url( $redirect_url ); ?>'
				}, 200);
			</script>
			<?php
			exit;
		}
	}