Viewing 6 replies - 1 through 6 (of 6 total)
  • Hello @mrbleuu !

    I trust you’re doing well today!

    I’ve asked our Second Line Support team to investigate this and if possible, to share a mu-plugin. We’ll update you here as soon as we hear back from them.

    Kind regards,
    Pawel

    Hello @mrbleuu !

    Please try the following snippet: https://pastebin.com/tDHd212d

    You’ll need to adjust:

    $upload_field_key = 'upload-1';

    To match your field’s name.

    if ( ! isset( $prepared_data['form_id'] ) || 710 !== intval( $prepared_data['form_id'] ) ) {

    Replace 710 with your form’s ID.

    Please let us know if it worked. I tested it on my site and it seemed to be doing exactly what’s needed. My email app still thought it’s a domain name and highlighted it, but there was no actual link.

    Kind regards,
    Pawel

    Thread Starter mrbleuu

    (@mrbleuu)

    It didn’t work unfortunately. I am using Forminator 1.17.1 as there are issues with values in conditional fields not being submitted in 1.17.2 (which you already know about and I think it will be fixed in the next release).

    I am not sure if 1.17.1 is the issue with your above code not working.

    Even a muplugin with bare bones such as this does not work – still sends email with linked url (this suggests the filter is not getting processed at all):

    <?php
    
    add_filter(
    	'forminator_get_formatted_form_entry',
    	function( $html, $custom_form, $prepared_data, $entry, $ignored_field_types ) {
    
    	
    			$html = 'nothing';
    
    		return $html;
    	},
    	10,
    	5
    );
    

    I have other muplugins working fine. I wonder if it is conflicting with these.

    I will use the solution smith37 posted for now.

    Thread Starter mrbleuu

    (@mrbleuu)

    I tried with a staging site with Forminator 1.17.2 + all other muplugins disabled + all other wordpress plugins disabled – it does not work; still getting a working link to file on server via email

    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @mrbleuu

    Are you using “{all_fields}” tag in your e-mail or “{all_non_empty_fields}” tag? Or are you using individual fields tags?

    I’m referring to the notification message body in Forminator – in e-mail notification configuration. IF you are not using “{all_fields}” try replacing the

    'forminator_get_formatted_form_entry',

    filter name in code with

    'forminator_get_formatted_form_non_empty_entry',

    Also, if that’s not the case or doesn’t work, try changing priority of (number 10 in your code) to e.g. 99.

    Best regards,
    Adam

    Thread Starter mrbleuu

    (@mrbleuu)

    Great this works. I was using non empty fields.

    I had to modify the code for it to work. Had to swap this line as basename would not accept an array which is what original code was passing:

    $file_url = $prepared_data[ $upload_field_key ]['file']['file_url'][0];

    Thanks so much for this. It’s great.

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