WordPress.org

Ready to get started?Download WordPress

Forums

Fast Secure Contact Form
Can the redirect bypass the originating page (2 posts)

  1. katandmouse
    Member
    Posted 1 year ago #

    Nice plugin Mike.

    Question, I'm using the redirect to a thank you page functionality. Typically the reason we do that is because we want to have complete control over that experience. There is no need for the user to return to the home page but the script sends them there. And even though I have it set to 0 seconds, I can see the "redirecting" message for about 3 seconds.

    Is there a way to bypass the originating page? Can we add some code that says "if there is a redirect page, go there directly?

    Thanks,
    Kathy

    http://wordpress.org/extend/plugins/si-contact-form/

  2. Mike Challis
    Member
    Plugin Author

    Posted 1 year ago #

    The reason it refreshes the same page first then redirects is to display the message "your message has been sent, thank you" on the page, then redirect.

    Some people use the redirect feature to make the form go back to the home page after the message is sent. But some might want a very custom thank you page.

    Adding some code will make it possible to have the redirect bypass. So now if you set the timeout to 0 seconds, then post the form, it gets instantly redirected to the redirect URL and you are responsible to display the "your message has been sent, thank you" message there.

    In version 3.1.8.2, edit si-contact-form-process.php near the bottom

    find

    }
        $fsc_message_sent = 1;
      } // end if ! error
     } // end if ! error

    put this directly above it

    // direct redirect, not meta refresh (and no thank you mesage sent!!)
                $ctf_redirect_timeout = absint($si_contact_opt['redirect_seconds']); // time in seconds to wait before loading another Web page
               if ($ctf_redirect_timeout == 0 && $ctf_redirect_url != '#' && $ctf_redirect_url_before != $this->form_action_url() ) {
               // use direct only when not set to same page, and redirect timeout seconds is 0.
                  if ($have_attach){
                    // unlink attachment temp files
                     foreach ( (array) $this->uploaded_files as $path ) {
                       @unlink( $path );
                     }
                 }
                  wp_redirect( $ctf_redirect_url );
    		      exit;
               }

    Be sure to set the redirect timeout to 0 seconds to use the redirect bypass

    I will add this to version 4.0 a beta will be out soon

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic