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

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

    (@eherman24)

    You’ll need to make sure that the $url variable is being populated.

    When I have a chance I’ll see if I can setup acf and replicate the issue. From what you’ve provided, it does appear correct, but I can’t be 100% without testing on my end as well.

    The screenshot settings look correct.

    Evan

    Yes, seems get_field("document", $page_data->ID) does not populate it. Tried with a hard-coded url and it works fine.

    I know that’s not your plugin, but any idea how the get the url from that ACF field within a filter? (name is fine as that works on other pages).

    I just var dumped $page_data->ID and it evaluates as “undefined”. Does it help?

    Plugin Contributor Evan Herman

    (@eherman24)

    Yes that certainly helps to explain why the redirect leads you back to the same page.

    Let me get things installed over here, setup a page with an ACF custom field and do some testing. I will post some code here for you.

    Thanks,
    Evan

    Found the problem is not ACF. I’ve tested with a hardcoded page id ($url = get_field("document", 2361);) and it works fine.
    The problem is the $page_data variable being undefined within the filter function. So probably some bug on the plugin code I presume.

    Plugin Contributor Evan Herman

    (@eherman24)

    I will take a look but as of yesterday morning, that variable was populated with the global $post data.

    OK, no doubting your word. But please have a look. I will have a look on the plugin’s code to see if I find something.

    Thank you very much again for all your support. 🙂

    Plugin Contributor Evan Herman

    (@eherman24)

    I’m assuming that the ACF field is assigned to pages? I just want to set it up on my end as close to your environment as possible.

    Evan

    Oh, no. This is a custom post type. Does it only work for pages?
    Check the screenshot: screenshot

    Plugin Contributor Evan Herman

    (@eherman24)

    No it should work for any post type (post, page, custom post type etc).

    So the user fills out the form on a report custom post type page, and is redirected to a download link that is populated in one of those ACF fields?

    and is the downloadable file the field for Attached Document?

    Yes. Those ACF fields apply to the custom post type “report” and the do_shortcode code is on the single-report.php file.

    Filter is at the end of my functions.php

    Full single-report.php code: link

    Plugin Contributor Evan Herman

    (@eherman24)

    Hi Ricardo,

    Just an update – I am still looking into this issue. The $page_data seems to be causing some sort of issue. Hopefully I can locate that for you shortly.

    Thanks,
    Evan

    Plugin Contributor Evan Herman

    (@eherman24)

    Hi Ricardo,

    So after some testing the file field actually returns an array, which you need to extract the URL parameter from that array.

    Take a look at the following gist that I have setup for you. This is working, and tested on my localhost install. I have an ACF file field called ‘attached_file’. You will most likely need to update that to be ‘document’.

    https://gist.github.com/EvanHerman/6ce76b12fef3a89f5e45

    Let us know if that works for you!

    Thanks,
    Evan

    I am not on my pc to test it but I don’t think that is the problem. ACF let’s you choose the return type. Default is array but mine is set to URL.

    If you see my paste in I have for non protected downloads:

    href=”<?php the_field(“document”);?>” and it works

    Definitely the problem is the $post_data. But I’ll have a look tomorrow in the morning.

    Thanks

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