Visual Form Builder 에서 결과페이지(Redirect)에 변수 전달하는 방법

visual-form-builder.php 또는 visual-form-builder-pro.php 소스에서 confirmation() 함수를 다음과 같이 수정한다.

/**
 * Handle confirmation when form is submitted
 * 
 * @since 1.3
 */
function confirmation(){
	global $wpdb;
	
	$form_id = ( isset( $_REQUEST['form_id'] ) ) ? (int) esc_html( $_REQUEST['form_id'] ) : '';
	
	if ( isset( $_REQUEST['visual-form-builder-submit'] ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'visual-form-builder-nonce' ) ) {
		// Get forms
		$order = sanitize_sql_orderby( 'form_id DESC' );
		$forms 	= $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->form_table_name WHERE form_id = %d ORDER BY $order", $form_id ) );
		
		foreach ( $forms as $form ) {
			
			// If user wants this to redirect to PayPal
			if ( $form->form_paypal_setting ) {
				
				// The Assign Prices
				$paypal_field = unserialize( $form->form_paypal_field_price );
				
				// By default, amount based on user input
				$amount = ( is_array( $_REQUEST[ $paypal_field['name'] ] ) ) ? $_REQUEST[ $paypal_field['name'] ][0] : stripslashes( $_REQUEST[ $paypal_field['name' ] ] );
				
				// If multiple PayPal prices are set, loop through them
				if ( $paypal_field['prices'] && is_array( $paypal_field['prices'] ) ) {
					// Loop through prices and if multiple, amount is from select/radio/checkbox
					foreach ( $paypal_field['prices'] as $prices ) {
						// If it's a checkbox, account for that
						$name = ( is_array( $_REQUEST[ $paypal_field['name'] ] ) ) ? $_REQUEST[ $paypal_field['name'] ][0] : $_REQUEST[ $paypal_field['name'] ];
						
						if ( $prices['id'] == $name )
							$amount = $prices['amount'];
					}
				}
				
				// Make sure jQuery is included
				wp_enqueue_script( 'jquery' );
				
				// Output the jQuery that will submit our hidden PayPal form
				$paypal = '';
				
				// The hidden PayPal form that sends our data
				$paypal .= '
'; $paypal .= apply_filters( 'vfb_paypal_extra_vars', '', $form_id ); $paypal .= '
'; // Message that replaces the usual success message $paypal .= '

' . __( 'Please wait while you are redirected to PayPal...', 'visual-form-builder-pro' ) . '

'; return $paypal; } // Allow templating within confirmation message $form->form_success_message = $this->templating( $form->form_success_message ); // If text, return output and format the HTML for display if ( 'text' == $form->form_success_type ) return stripslashes( html_entity_decode( wp_kses_stripslashes( $form->form_success_message ) ) ); // If page, redirect to the permalink elseif ( 'page' == $form->form_success_type ) { $page = get_permalink( $form->form_success_message ); //wp_redirect( $page ); //exit(); wp_enqueue_script( 'jquery' ); $paypal = ''; $paypal .= '
'; //print_r($_POST); // Get fields $order_fields = sanitize_sql_orderby( 'field_sequence ASC' ); $fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->field_table_name WHERE form_id = %d ORDER BY $order_fields", $form_id ) ); foreach ( $fields as $field ) { $paypal .= ''; if ($field->field_type=='email') { $paypal .= ''; } } //$paypal .= apply_filters( 'vfb_result_extra_vars', '', $form_id ); $paypal .= '
'; return $paypal; } // If redirect, redirect to the URL elseif ( 'redirect' == $form->form_success_type ) { //wp_redirect( $form->form_success_message ); //exit(); wp_enqueue_script( 'jquery' ); $paypal = ''; $paypal .= '
'; //print_r($_POST); // Get fields $order_fields = sanitize_sql_orderby( 'field_sequence ASC' ); $fields = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $this->field_table_name WHERE form_id = %d ORDER BY $order_fields", $form_id ) ); foreach ( $fields as $field ) { $paypal .= ''; if ($field->field_type=='email') { $paypal .= ''; } } //$paypal .= apply_filters( 'vfb_result_extra_vars', '', $form_id ); $paypal .= '
'; return $paypal; } } } }