This hook allows you to do something with the data that was entered in the form before it is changed and the form is updated.
Usage
add_filter('frm_pre_update_entry', 'check_if_value_changed', 10, 2);
Parameters
- $values (array)
- $entry_id (integer)
Examples
Check If Value Has Changed
You can use the following example to check to see if a value has changed. In this specific example, if the value has not changed, an email notification will not be sent.
add_filter( 'frm_pre_update_entry', 'check_if_value_changed', 10, 2 ); function check_if_value_changed( $values, $entry_id ) { $field_id = 125; // change 125 to the id of the field to check $previous_value = FrmEntryMeta::get_entry_meta_by_field($entry_id, $field_id); if ( isset( $values['item_meta'][ $field_id ] ) && $values['item_meta'][ $field_id ] == $previous_value ) { // do something if the value did not change add_action( 'frm_trigger_email_action', 'frm_stop_email', 1 ); } return $values; } function frm_stop_email(){ remove_action( 'frm_trigger_email_action', 'FrmNotification::trigger_email', 10 ); }
If you would like to add your own example, click here.
Change Log
Last changed in version 2.0.16
Have something to add?
Click here to provide feedback on this page.