Support » Plugin: Easy Forms for Mailchimp » Redirect URL as a parameter

Viewing 15 replies - 1 through 15 (of 41 total)
  • Plugin Contributor Evan Herman

    (@eherman24)

    Hi Rjpedrosa,

    Did you ever come up with a solution to this. If interested in using our latest stable release of the upcoming version, I would be more than willing to come up with a solution for you.

    Sounds like a reasonable request, and something that others may need help setting up in future. Either way, you can download the latest stable release from: https://cloudup.com/files/iVYPwaobOjl/download

    You can post back here, and we can discuss or you can reach out via email and we can discuss in private.

    Thanks,
    Evan

    Hi,

    Sorry, been away for some time. Thank you for taking my suggestion. Have you been able to implement it?

    Thanks.
    Ricardo

    Plugin Contributor Evan Herman

    (@eherman24)

    Hi Ricardo,

    We haven’t built in the feature. In our upcoming release we no longer support the php snippet. If users will be using the shortcode inside of templates, they should use the <a href="https://developer.wordpress.org/reference/functions/do_shortcode/" target="_blank">do_shortcode()</a>; function.

    For example, you would display form #3 in the following way:

    <?php echo do_shortcode( '[yikes-mailchimp form="3" submit="Submit"]; ?>

    If you still need support to redirect users based on a parameter, I’m not sure that adding an additional parameter to the short code would be the best way to go. I think adding in some sort of filter to allow the user to alter the URL how they need would be most flexible, and would prevent additional attributes in the shortcode.

    If that’s something that would be helpful to you, I can quickly add in a new filter to wrap the redirect URL with. Then you can download the latest stable release (which we should be finally releasing this coming Monday). Once downloaded, I can write some code for you to help you out with altering the redirects.

    Thanks,
    Evan

    Ok, seems that suits. All I need is to have different redirects for the same form (I want to protect different PDFs with the same exact form).
    Thank for all your precious help.
    Keep me updated.

    Thanks!
    Ricardo

    Plugin Contributor Evan Herman

    (@eherman24)

    Hi Ricardo,

    I will be working on the plugin for the next couple of hours and will work on getting that filter in there for you and providing an example on how to use it.

    Thanks again for all your patience!

    Evan

    Hi Evan!

    Any news on this? Sorry for bugging! 😛

    Thanks,
    Ricardo

    Plugin Contributor Evan Herman

    (@eherman24)

    Hi Ricardo,

    We will be pushing the new release out in the next hour or so. I just included a new filter this morning, yikes-mailchimp-redirect-url, which will allow you to add query arguments to the redirect URL. I can provide you with an example function that you can use to alter the URL to your needs.

    I will post that solution here shortly.

    Thanks again for your patience 🙂
    Evan

    Hi,

    Cool. Can’t wait to see it! 🙂
    Yes, please post an example.

    Many thanks for being so helpful with this request. 🙂

    Ricardo

    Plugin Contributor Evan Herman

    (@eherman24)

    Hi Ricardo,

    As you may be able to see, we just pushed out the latest release of the plugin.

    Once you have that installed – you can use the following function to alter where the user is redirected too after submitting a form.

    https://gist.github.com/EvanHerman/d2b9beb5cfd95cbf586b

    You’ll want to place that function inside of functions.php, and swap out the ID of the form that you are targeting, the ID of the page that you want to alter the redirected URL on and the URL the user will be redirect too. I’ve provided two different examples, redirecting to an external URL or simply adding query arguments to the URL of the page that you had selected to redirect the user too.

    Let me know if you need some help setting all that up and I’ll do my best to help you out and provide some code.

    Thanks again,
    Evan

    function yikes_mailchimp_alter_redirect_url( $url, $form_id, $page_data ) {
    
           $url = get_field("file_url", $page_data->ID);
    
    	// return the altered URL
    	return $url;
    }
    add_filter( 'yikes-mailchimp-redirect-url', 'yikes_mailchimp_alter_redirect_url', 10, 3 );

    Unable test at the moment, but I assume this will work for me (I am using Advanced Custom Fields with a field called “file_url”). Or not?

    Thanks

    Plugin Contributor Evan Herman

    (@eherman24)

    Hi Ricardo,

    That looks like it will work perfectly. If for some reason it doesn’t, fee free to let us know.

    Evan

    Hi,

    The form is working fine (emails are being saved on mailchimp), but it is not redirecting to the file. Nothing happens after getting the successful message… :S

    Code on template file:
    <?php echo do_shortcode('[yikes-mailchimp form="1"]'); ?>

    Filter code:

    function yikes_mailchimp_alter_redirect_url( $url, $form_id, $page_data ) {
    
           $url = get_field("document", $page_data->ID);
    
    	// return the altered URL
    	return $url;
    }
    add_filter( 'yikes-mailchimp-redirect-url', 'yikes_mailchimp_alter_redirect_url', 10, 3 );

    Do I need to explicitly set the form ID?

    Plugin Contributor Evan Herman

    (@eherman24)

    No you shouldn’t need to set the form ID.

    Are you sure that the $url is being populated properly?

    If it’s not redirecting, it’s possible that the $url parameter is either empty or undefined.

    Within the edit form page for form #1, under ‘Submissions settings’ did you set ‘Redirect On Submission’ to ‘yes’?

    Evan

    I haven’t, but I have now. But it redirects to the same page, not to the file.
    Any way to check if the filter is working and the $url is being populated?

    These are my settings for the form:
    Screenshot

Viewing 15 replies - 1 through 15 (of 41 total)
  • The topic ‘Redirect URL as a parameter’ is closed to new replies.