• Resolved Bessonweb

    (@besky)


    Hello,

    I use Forminator to display a form to download a file after submit and all was work good but since a few days or more, the redirect and the mail print the variable instead the url I want.

    In my field “file” I have a variable “%file_url%”

    In my functions.php I have this code :

    /* Replace variable with data in forminator */
    add_filter('forminator_field_markup', function( $html ) {
    
      // The file to download in landing pages
      if ( get_post_type( get_the_id() ) == 'landing' ) {
    
        $file_url = get_field('fichier', $post_id);
    
        if ( ! empty( $file_url ) ) {
    
          $html = str_replace( '%file_url%', $file_url, $html );
    
        }
      }
    
      return $html;
    }, 99);

    When I look into the HTML, the URL is correctly filled. But when we submit the form, the redirect URL is :

    https://my-website.com/url-of-my-landing-page/%file_url%

    And in the mail in place of the URL, it print the variable %file_url%

    Please can you help me to resolve this?

    Thank you!

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter Bessonweb

    (@besky)

    The bug was appeared between Avr 3, 2023 and Avr 17, 2023.

    Strangely, we have no updated the plugin or other plugin related to this bug between these dates.

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @besky

    Is there any reason why you dont use default built-in features for that? With Forminator you can set up own redirect and on that page you can place your file to download. That page can be set to be visible only for logged in users with some 3 party plugin if necessary. As for file you can use {upload-1} in your your email.

    Also, 2 weeks ago there was an update in Forminator, but it seems you do not use Formiantor 1.24.1, is that correct?

    Just to be on the same page, no updates was made on the site between April 2-17? If so those are updates we have made around that time:

    April 3 / version 1.23.2

    • Improvement: Compatibility with WordPress 6.2
    • Improvement: Security improvements

    April 10 / version 1.23.3

    • Improvement: Security improvements
    • Fix: Hidden field query parameters are not saved on submission

    Can you make a staging site and see will it work with old version 1.21.1 which you can download here: https://www.ads-software.com/plugins/forminator/advanced/

    Kind Regards,
    Kris

    Thread Starter Bessonweb

    (@besky)

    Hi Kris,

    I don’t use the default built-in feature because I have many pages with one document per page and the same form for all these pages. So the file is uploaded per an ACF field and filled dynamically in an hidden field in the form.

    I use the 1.24.1 since 2 days. So it seem it’s not an update problem.

    I will try to rollback to 1.21.3 to see if it fix the bug.

    Thanks for your help. Have a good day!

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @besky

    I hope you are doing well and safe!

    Wondering if rolling back the plugin version helped you?

    Best Regards
    Patrick Freitas

    Thread Starter Bessonweb

    (@besky)

    Hi Patrick,

    I’m good thank you. Yes here are my tests :

    1.20.1 ok
    1.21.0 ok
    1.22.1 ok
    1.23.3 no

    So I think the 1.23.3 introduce the bug.

    Either a modification that affects hidden fields, or the “forminator_field_markup” filter perhaps?

    Have a good day!

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @besky

    The hidden fields are now sanitized and they cannot contain any other value than set in field settings. This is not a bug but a change made on purpose in the plugin for security reasons to prevent certain types of attacks/injections.

    That’s why your code doesn’t work.

    I’m sorry for creating confusion earlier.

    The simplest workaround for this is to replace field of type “hidden” with a field of type “input” (which by design is meant to accept user input) and then hide that field with CSS (but NOT with visibility settings!).

    You can then use the very same code that you used so far with no changes needed – only the redirect link should be modified to use this new input field instead of previously used hidden field.

    Kind regards,
    Adam

    Thread Starter Bessonweb

    (@besky)

    Thanks for you reply Adam !

    I will do that! It would be great to have a native solution to make this.

    I hope you a good day!
    Richard.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Field in redirect and email print variable instead of field content’ is closed to new replies.