• Resolved terriz

    (@terriz)


    BTW – loving Forminator (just left a 5-star review!) and really appreciating the great support here!

    Notification emails. In searching the support forum, this support thread seems to indicate that the default {all_fields} pulls in the labels on the forms – but that is not what I’m seeing, specifically on the address fields.

    Example: Address field. I have broken this up into 5 fields, each requiring just one of the sub-fields. (I did this so I had control over how many fields fit on one line.)

    1. For the sub-field: Apartment, suite, etc.
    The label is Apartment/Unit #
    The placeholder is blank

    In the email, what I get is
    Address
    Address Line 2: abc

    2. For the sub-field State / Province
    The label is Province
    The placeholder is blank

    In the email, what I get is
    Address
    State: xyz

    The latter could be confusing to my client, who is in Canada and would only be accepting applications from folks in Canada. Same with Zip code, which should be Postal Code

    Is this something that I just have to create the email manually by adding all the fields? I’m hoping for a functions.php filter similar to the one the developers provided in the support link above.

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

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter terriz

    (@terriz)

    A little bump – hoping Adam (@wpmudev-support8) can help me out!

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @terriz ,

    I’m super sorry for missing your post. It slipped through the cracks.

    I’m checking with our developers if there is a way to do that with a code snippet. We will let you know if there is a coding solution for that.

    kind regards,
    Kasia

    Thread Starter terriz

    (@terriz)

    Thanks @wpmudev-support2 ??

    Plugin Support Amin – WPMU DEV Support

    (@wpmudev-support2)

    Hello @terriz ,

    Can you check this code:

    add_filter( 'forminator_custom_form_submit_field_data', function( $field_data_array, $form_id ){
    	$submitted_field_ids = wp_list_pluck( $field_data_array, 'name' );
    
    	$form                = Forminator_Form_Model::model()->load( $form_id );
    
    	foreach ( $form->get_fields() as $field ) {
    		if ( in_array( $field->slug, $submitted_field_ids ) ) {
    			continue;
    		}
    
    		$field_data_array[] = array(
    			'name'  => $field->slug,
    			'value' => $field->__get( 'field_label' )
    		);
    	}
    
        return $field_data_array;
    }, 20, 2 );

    This would be a start code.

    kind regards,
    Kasia

    Thread Starter terriz

    (@terriz)

    I added the code above to the functions.php child theme file. Unfortunately, it still says “State” instead of “Province”, etc. From the email:

    Today’s Date
    2021-08-19
    Name
    First Name : Testing – should change State to Province, etc., in email
    Name
    Middle Name :
    Name
    Last Name : Terri Z
    Address
    Street Address : 123 main street
    Address
    Address Line 2 : 14 << should be Apartment/Unit #
    Address
    City : kelowna
    Address
    State : BC << should be Province
    Address
    Zip : 123def << should be Postal Code
    Phone
    +19193634597
    Email
    [email protected]`

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @terriz

    As Kasia said it would be a start of code only, you or a developer would need to extend it.

    Could you export your form and we can take a quick look?

    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    Upload to Google Drive and share the link.

    Best Regards
    Patrick Freitas

    Thread Starter terriz

    (@terriz)

    Oh! I was unclear what that meant “start code”

    https://drive.google.com/file/d/1NCwiieWjJC1hpibDM2Wf9Px7MyxjZhnT/view?usp=sharing

    Thank you!

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @terriz

    Thank you for the form,

    I see it is a bit more complex situation and the complete code is out of support scope.

    But you can manage it by modifying the start code and using some conditionals.

    instead of

    $field_data_array[] = array(
    			'name'  => $field->slug,
    			'value' => $field->__get( 'field_label' )
    		);

    You will need to extend the conditionals to manage all fields and add the correct name and value to field_data_array.

    $field_data_array[] = array(
    			'name'  => ..something_else,
    			'value' => ..something_else
    		);

    I suggest asking your developer to give a print_r in $form->get_fields() example after the Forminator_Form_Model::model()->load( $form_id );

    Include it on already shared code, something similar to:

    
    ... Previous code
    
    $form = Forminator_Form_Model::model()->load( $form_id );
    
    	echo '<pre>';
    
    	print_r( $form->get_fields() );
    
    	echo' </pre>';
    
    	exit;
    
    .. More code
    
    

    Also, go to Forminator > Form > Behaviour and make the form submit > Page Reload instead of Ajax, once you submit the form you can see the entire form structure https://monosnap.com/file/6dJfXCWWSGpVsWJtU5Qr1wDJX2vJLU

    Similar to provided code you will be able to loop in this structure and filter the information based on what you are looking for.

    Let us know if you have any additional questions.
    Best Regards
    Patrick Freitas

    Thread Starter terriz

    (@terriz)

    Even though the answer is out of scope (I understand that!) this is very helpful! I’ll work it out with my tech guy ??

    Thanks!

    Peace,
    Terri Z

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @terriz

    I hope you are doing well.

    I am happy to hear it was helpful, feel free to let us know if you have any additional questions.

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @terriz

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional questions or problems.

    Best Regards
    Patrick Freitas

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Field labels in notification email on address fields’ is closed to new replies.