Forums

Redirect Not Working

mikeenan 03 May, 2016
Does Chronoforms redirect work in Wordpress? I've followed the advice given here in the Chronoforms Wordpress forums and have noticed other people saying that it is not working in a couple of other posts.
I had used Chronoforms on Joomla and it worked great so I went and bought it for Wordpress only to find the functionality doesn't seem to be working especially variable redirect which is the reason that I bought it.
Please advise.

Reference threads:
http://www.chronoengine.com/forums/posts/f31/t101703/redirect-doesnt-work.html?hilit=redirect
http://www.chronoengine.com/forums/posts/f31/t101661/dynamic-dropdown-only-works-on-1-form-page.html?hilit=redirect
http://www.chronoengine.com/forums/posts/f31/t98407/how-do-i-load-a-different-form-after-i-submit-the-current-form.html?hilit=redirect
GreyHead 04 May, 2016
Hi mikeenan,

Please ask Max, the owner and developer, directly using the Contact Us menu above. I don't know enough about CF on WordPress to give you a clear answer here :-(

Bob
mikeenan 06 May, 2016
Bob,
I appreciate the reply even if you can't help. I've filled out the contact form and I hope to get a reply soon. I really like the features of Chronoforms in Joomla and hope that the same functionality exists in Wordpress.
Thanks,
Mike
GreyHead 06 May, 2016
Hi Mike,

I have an old WP site that I can try and install CF on to see if I can work out what is (or isn't) happening.

Bob
mikeenan 09 May, 2016
Bob,
Thanks so much. Let me know what you find out.
Thanks!
Mike
GreyHead 10 May, 2016
Hi Mike,

I have a workaround for this using JavaScript - so far I haven't found a reliable way to do the redirection when the form is embedded in an post.

Open the file /wp-content/plugins/chronoforms5/cegcore/libs/env.php and look for the redirect() function around line 14
  public static function redirect($url){
    header('Location: '.str_replace('&', '&', $url));
    ob_end_flush();
    exit();
  }
Replace the function with this version:
  public static function redirect($location){
    $location = str_replace('&', '&', $location);
    if ( !headers_sent() ) {
      wp_redirect( $location, 301 );
      exit;
    } else {
      echo "<div>Redirecting, please <a href='{$location}'>click here</a> if you are not redirected in 10 seconds.</div>";
      echo "<script> self.location='{$location}'; </script>";
      exit;
    }
    ob_end_flush();
    exit();
  }

When you submit the original page shows briefly then the script redirects to the requested URL.

Bob
mikeenan 10 May, 2016
Bob,
Thanks for the try, but this doesn't seem to make a difference.
I was able to make the changes that you specified and the only difference was that my path was
/wp-content/plugins/chronoforms/cegcore/libs/env.php and not /wp-content/plugins/chronoforms5/cegcore/libs/env.php
The chronoforms folder did not have a 5 on the end but I do have Version 5.0.9
Just to be clear, I am following the procedure outlined in this post using the event switcher and redirect options.
http://www.chronoengine.com/forums/posts/f31/t98407/how-do-i-load-a-different-form-after-i-submit-the-current-form.html?hilit=redirect
Thanks again!
Mike
GreyHead 10 May, 2016
Hi MIke,

It's working OK when I test, maybe there's a JavaScript error on your page? Please post a link to the form so I can take a quick look.

Bob
This topic is locked and no more replies can be posted.