Home>

I am using MW WP Form with WordPress.
1. 1. Form input screen → 2. Confirmation screen → 3. The transition is based on the flow of the transmission completion screen.
When transitioning to the transmission completion screen, you will be redirected to the input screen of 1 in an instant (a glance).
I am aiming to complete (do not redirect) by displaying the completion screen, but I could not do it, so I asked a question.

■ Prepared and set
Each page
Form input screen/contact
Confirm screen/confirm
Send completion screen/complete
We have prepared a fixed page with the contents of.

The presence/absence of/in the "URL setting" of the MW WP Form has been unified.
The perm link setting is /% postname%.
The same short code [mwform_formkey key = "5"] is entered for all input, confirmation, and completion.

■ Suspicious part
The part that seems to be the cause is the following action hook.
add_action ('mwform_after_send_mw-wp-form-5','fileio_mwform_after_send');

The contents of fileio_mwform_after_send are about reading and writing files.
(Processing to write information to a text file on the server, up to 5 files)

・ Excerpt of specific processing contents
$key ='xxxxxx';
$encString ='xxxxx';
$cStr = openssl_encrypt ($encString,'AES-128-ECB', $key);
file_put_contents ("/home/xxx/xxx.com/test.log", $cStr);

The processing of this action hook completes without any error.
I tried disabling this action hook and the redirect from the completion screen disappeared.

It would be helpful if you could teach me how to keep this action hook alive and not redirect from the completion screen.
I look forward to working with you.

■ Environment
Xserver
WordPress 5.5.3
MW WP Form 4.3.2 (latest version)

  • Answer # 1

    Exporting the file I commented out the code below and it worked fine.

    file_put_contents ("/home/xxx/xxx.com/test.log", $cStr);
    This process was working fine.

    This process seems to be interfering with something.
    By the way, trying file operations using wp-admin/includes/file.php instead of file_put_contents didn't help.

    It was not possible to not redirect while leaving the processing, but we will aim for implementation in another way.
    Thank you very much.