Displaying submitted form data after redirecting

Step 1

Add the following code to the theme functions.php file (or create a plugin for it).

12
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
add_filter('quform_post_process_1', function(array $result, Quform_Form $form) {    $session = Quform::getService('session');
    $session->set('forms.' . $form->getId(), $form);
 
    return $result;
}, 10, 2);
 
add_shortcode('quform_all_form_data', function($atts) {
    if ( ! class_exists('Quform')) {
        return;
    }
 
    $atts = wp_parse_args($atts, array('id' => '0'));
 
    $session = Quform::getService('session');
    $form = $session->get('forms.' . $atts['id']);
 
    if ( ! $form instanceof Quform_Form) {
        return;
    }
 
    return $form->replaceVariables('{all_form_data}', 'html');
});
add_filter('quform_post_process_1', function(array $result, Quform_Form $form) {
    $session = Quform::getService('session');
    $session->set('forms.' . $form->getId(), $form);

    return $result;
}, 10, 2);

add_shortcode('quform_all_form_data', function($atts) {
    if ( ! class_exists('Quform')) {
        return;
    }

    $atts = wp_parse_args($atts, array('id' => '0'));

    $session = Quform::getService('session');
    $form = $session->get('forms.' . $atts['id']);

    if ( ! $form instanceof Quform_Form) {
        return;
    }

    return $form->replaceVariables('{all_form_data}', 'html');
});
  • On line 1, replace the number 1 with the form ID
1
2
3
4
5
6
7
89
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function my_post_process(array $result, Quform_Form $form)
{
    $session = Quform::getService('session');
    $session->set('forms.' . $form->getId(), $form);
 
    return $result;
}
add_action('quform_post_process_1', 'my_post_process', 10, 2); 
function my_quform_all_form_data_shortcode($atts) {
    if ( ! class_exists('Quform')) {
        return;
    }
 
    $atts = wp_parse_args($atts, array('id' => '0'));
 
    $session = Quform::getService('session');
    $form = $session->get('forms.' . $atts['id']);
 
    if ( ! $form instanceof Quform_Form) {
        return;
    }
 
    return $form->replaceVariables('{all_form_data}', 'html');
}
add_shortcode('quform_all_form_data', 'my_quform_all_form_data_shortcode');
function my_post_process(array $result, Quform_Form $form)
{
    $session = Quform::getService('session');
    $session->set('forms.' . $form->getId(), $form);

    return $result;
}
add_action('quform_post_process_1', 'my_post_process', 10, 2);

function my_quform_all_form_data_shortcode($atts) {
    if ( ! class_exists('Quform')) {
        return;
    }

    $atts = wp_parse_args($atts, array('id' => '0'));

    $session = Quform::getService('session');
    $form = $session->get('forms.' . $atts['id']);

    if ( ! $form instanceof Quform_Form) {
        return;
    }

    return $form->replaceVariables('{all_form_data}', 'html');
}
add_shortcode('quform_all_form_data', 'my_quform_all_form_data_shortcode');
  • On line 8, replace the number 1 with the form ID

Step 2

Create a page in WordPress that the form should redirect to, and use the shortcode below in the page content.

[quform_all_form_data id="1"]
  • Replace the number 1 with the form ID

Then go to Edit Form → Settings → Confirmations then to the settings for the Default confirmation. At the Type option choose Redirect to another page and choose the page you just created.

Still having trouble? Head over to the forums.

Forums