Jump to content

Steve40

New Members
  • Posts

    1
  • Joined

  • Last visited

Steve40's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Greetings! I'm kinda learning php as I go along here (though I do have some experience in other languages), so I'm hoping someone can point me in the right direction. I'm using an add_action() function in functions.php to access the form data from an Elementor form. Works fine from within add_action(), however I cannot access any of the variables created from elsewhere within functions.php (tried adding a return). There's probably an easy solution, but I've been wracking my brains all weekend, and haven't gotten anywhere. Any thoughts? Side Thought: I've also tried do_shortcode(), which does retrieve the information I need, but it seems to modify it somehow, so comparison opperators return as false, even though they are visually equal. add_action( 'elementor_pro/forms/new_record', function( $record ) { $form_name = $record->get_form_settings( 'form_name' ); if ( 'MyElementorForm' !== $form_name ) { return; } $raw_fields = $record->get( 'fields' ); $fields = []; foreach ( $raw_fields as $id => $field ) { $fields[ $id ] = $field['value']; } $letter_type = $fields['LetterType']; // Send Test Email // if($letter_type === "1"){ $message = "Upload"; } elseif($letter_type === "0"){ $message = "PDF"; } else { $message = "Fail " . gettype($letter_type) . " " . $letter_type; } mail( "my@email_address.com", "Test", "Test Message " . $message ); }, 10, 2);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.