Support

Account

Home Forums Backend Issues (wp-admin) Issue with getting data from Elementor form Reply To: Issue with getting data from Elementor form

  • HI @samnymr

    I’m not at all familiar with elementor, however, can you see if the below works:

    <?php
    add_action( 'elementor_pro/forms/new_record', function( $record, $handler ) {
    	//make sure its our form
    	$form_name = $record->get_form_settings( 'form_name' );
    	if ( 'Create New User' !== $form_name ) {
    		return;
    	}
    	$raw_fields = $record->get( 'fields' );
    	$fields = [];
    	
    	$admin_email = $no_exists_value = get_option( 'admin_email' );
    	
    	$to = $admin_email;
    	$subject = 'Test form submission data';
    	$message = 'Form data';
    	
    	foreach ( $raw_fields as $id => $field ) {
    		$fields[ $id ] = $field['value'];
    		$message .= $field['value'];
    	}	
    	
    	$headers = 'From: My Name <[email protected]>' . "\r\n";
    	wp_mail( $to, $subject, $message, $headers );
    }, 10, 2);

    The idea being on form submission, it should email the site admin address a list of form data.
    Check whether the company name is present.

    If not, the data isn’t reaching the submission.

    If it is, you can then look to see which part may then be failing.