Support » Plugin: Contact Form 7 » Custom dynamic fields in mail

  • I’m creating some dynamic input fields in my form depending on an number that user put in another field.
    These fields can be 1 or 20 or whatever amount and have different name like additional-field-1, additional-field-2 etc.
    I want to get these fields in my mail body after user submit his form.
    Tried to use a custom function in my themes functions.php by using this code

    add_action('wpcf7_before_send_mail', 'additional_attendees');
    
    function additional_attendees($wpcf7) {
     		
    		$submission = WPCF7_Submission::get_instance();
    				
    		//GET VALUES
    		$data = $submission->get_posted_data();		
    }

    but the get_posted_data() function doesn’t contain any of these fields, only the ones that i have used shorthands in my mail settings tab editor in wordpress.
    So i guess i have to create some custom shorthands for them.
    I’m trying to find a way to do that for infinite amount of custom fields but i’m not able to find anything.
    Any help would be really appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom dynamic fields in mail’ is closed to new replies.