Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active October 2, 2017 17:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/0202846fc63079db0748b7675ff33955 to your computer and use it in GitHub Desktop.
Save Shelob9/0202846fc63079db0748b7675ff33955 to your computer and use it in GitHub Desktop.
Change Caldera Forms field values using caldera_forms_entry_saved action. See: https://calderawp.com/doc/caldera_forms_entry_saved/
<?php
add_action( 'caldera_forms_entry_saved', function( $entryid, $new_entry, $form ){
//get value of field with ID fld123456
$value = Caldera_Forms::get_field_data( 'fld123456', $form, $entryid );
//if value is a number and greater than 25 change field with ID fld42424242's value to "tacos"
if( is_numeric( $value ) && 25 < $value ){
Caldera_Forms::set_field_data( 'fld42424242', 'tacos', $form, $entryid );
}
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment