• Resolved smith37

    (@smith37)


    Hi,

    I have a form set up with a single file upload. All works well, the form sends the file as an attachment.

    However, the filename in the email appears as a clickable link. Where can I find the code that tells the email to only print the file name and not have it as a link?

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @smith37

    I hope you’re well today!

    I believe you are using “{all_fields}” or “{all_non_empty_fields}” macro in e-mail notification content.

    This would add such link regardless of whether the file is added as attachment or not because it literally says to include values of all the form fields in e-mail message.

    Instead, you’d need to use individual field macros. If you edit notification and click on a little blue(ish) square icon in message editor you’ll see all available macros, including individual ones for separate fields.

    You would need to put only those there that you actually want to be included (so skip and not add e.g. upload ones).

    Kind regards,
    Adam

    Thread Starter smith37

    (@smith37)

    Hi Adam,

    No, I’m not using {all-fields} – I have the individual fields listed.
    https://i.postimg.cc/NG315XC3/Screenshot-2022-07-20-124442.png

    This is the email result.
    https://i.postimg.cc/y82N1h85/Untitled.png

    What I’d like is to just have the filename shown, without it being a link, but I don’t know where the code is to look at removing the instruction to make a link.

    • This reply was modified 2 years, 4 months ago by smith37.
    • This reply was modified 2 years, 4 months ago by smith37. Reason: Added more info
    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @smith37

    Thank you for response!

    The first screenshot shows that even using individual macros you are still including value of upload field in message. The {upload-1} macro does not create attachment – it is simply replaced by the actual field value which really is just an URL of the uploaded file. How this is displayed in e-mail is mostly a matter of e-mail client but that’s it.

    It’s not necessary to keep attachment in email. My suggestion then:

    – edit your e-mail notification and remove this line

    Attachment: {upload-1}

    – make sure that the switch in “Attachments” section below message body editor is set to “Uploaded files” instead of “None”

    – click “Add” and then update the form.

    Uploaded file will still be attached to the message but the URL will not be included in e-mail message.

    Best regards,
    Adam

    Thread Starter smith37

    (@smith37)

    Hi Adam,

    While I appreciate your typing all of that out, I am already using the attach to email function, which attaches the file for the recipient at our company.

    What I want is exactly what I’ve shown above – for the customer’s response to have a copy of the message they left and the filename that they uploaded. I do not want that filename to be in link form, though, just text.
    If it shown as a linked filename in the email, why can I not just remove the surrounding < a > tags, or whatever it does, to show only the name?

    • This reply was modified 2 years, 4 months ago by smith37.
    Thread Starter smith37

    (@smith37)

    Thanks again for your time – but I have now found what I need!

    I’ve edited library/helpers/helper-fields.php at line 1032 to simply read
    $file_name = $file_name;

    Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi @smith37,

    I hope you are doing well today!

    We are happy to hear the issue resolved, however, please note that since you patched the plugin file, it could be changed on the next update as you may already aware of.

    Kind regards,
    Zafer

    Thanks smith37. I found this useful and applied your fix for similar reasons.

    • This reply was modified 2 years, 2 months ago by mrbleuu.

    How could I make a muplugin for this so it is not affected by future updates?

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @mrbleuu

    I hope you are doing well.

    We don’t suggest overriding the core files, in case you would like something more permanent feel free to create a new ticket https://www.ads-software.com/support/plugin/forminator/#new-topic-0 and we can take a closer look, per forum rules we don’t spam the thread starter.

    Best Regards
    Patrick Freitas

    Hi @smith37 glad you found a solution!

    As @mrbleuu mentioned at, making a mu-plugin would be a good way to have this persist after plugin updates. Since I’m not too familiar with that yet, I did find another way to accomplish this.

    You can place this javascript snippet on the page with the form, and it will grab the file-name value from the upload field, and input it into a hidden field. You can then use the {hidden-1} macro in your email.

    <script>
    jQuery("#forminator-field-upload-1").change(function(){
        var upload = document.getElementById("forminator-field-upload-1");
        var upload_name = upload.nextSibling.nextSibling.innerHTML;
        jQuery("#hidden-1").attr("value",upload_name);
    });
    </script>

    Here’s a gif of it in action: https://recordit.co/G5x0MGJnoV.gif

    Note: The IDs for the #forminator-field-upload-1 and #hidden-1 field will need to be updated if they aren’t the first instance of that type on your form.

    Hope this was helpful

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Remove link from upload filename in email’ is closed to new replies.