Saltar navegación

[Resuelto] Can I redirect user after showing the form submission message?

This support ticket is created hace 3 años, 4 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Zona horaria del colaborador: America/Jamaica (GMT-05:00)

Este tema contiene 3 respuestas, tiene 2 mensajes.

Última actualización por Shane hace 3 años, 4 meses.

Asistido por: Shane.

Autor
Mensajes
#2339819

I want to show the confirmation message on the form submission and then after 2 seconds redirect the user to the edited post. Can this be done with Toolset?

#2339873

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Himanshu,

Thank you for getting in touch.

Unfortunately if you're using the display a message option then you won't be able to redirect after this.

The default redirection setting does display a short message "Please Wait, you are being redirected" after the form has been submitted so you can use this option.

I was also looking for a way to change this message but haven't found any.

Thanks,
Shane

#2339903

I was able to change the redirect message like this

<?php
/**
 * New custom code snippet (replace this with snippet description).
 */

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

// Put the code of your snippet below this comment.
add_filter( 'gettext', 'custom_cred_redirection_msg_func', 20, 3 );
  
function custom_cred_redirection_msg_func( $translated_text, $text, $domain ) {
    if($text == 'Please Wait. You are being redirected...' && $domain = 'wp-cred'){
        $translated_text = "<strong style='font-size:20px;margin-right:5px;'>Processing...<br><img alt='' src='filename' width='140' height='16'/></strong>";
    }
    return $translated_text;
}
?>

Is there a way to look for the right form in the above code and then show a custom message per form?

#2339923

Shane
Colaborador

Idiomas: Inglés (English )

Zona horaria: America/Jamaica (GMT-05:00)

Hi Himanshu,

You may not be able to get the specific form ID however you can perform the trigger based on the Post/Page ID given that the message is still being displayed on the same page.

Thanks,
Shane