DescriptionUsageParametersExamplesPlacementSource Code
Description
Use this action hook to perform logic when entries』 basic information is updated.
Usage
Specify the property name after the gform_update_ hook name:
1add_action( 'gform_update_status', 'status_changed', 10, 3 );
Parameters
$entry_id integer
Current entry ID.
$property_value Mixed
New value of the entry』s property.
$previous_value Mixed
Previous value of the entry』s property.
Examples
This example automatically deletes entries that are marked as Spam:
123456add_filter( 'gform_update_status', 'delete_spam', 10, 3 );function delete_spam( $entry_id, $property_value, $previous_value ) { if ( $property_value == 'spam' ) { GFAPI::delete_entry( $entry_id ); }}
This example sends an email to the admin whenever an entry』s status changes:
123456789add_action( 'gform_update_status', 'check_lead_status', 10, 3 );function check_lead_status( $entry_id, $property_value, $previous_value ) { if ( $previous_value != $property_value ) { $to = get_bloginfo( 'admin_email' ); $subject = "The status of entry {$entry_id} has changed."; $message = "The status of entry {$entry_id} has changed. Please review this entry."; wp_mail( $to, $subject, $message ); }}
This example sends an email to the admin whenever an entry is starred:
123456789add_action( 'gform_update_is_starred', 'check_starred_status', 10, 3 );function check_starred_status( $entry_id, $property_value, $previous_value ) { if ( $previous_value != $property_value && $property_value == 1 ) { $to = get_bloginfo( "admin_email" ); $subject = "Entry {$entry_id} has been starred as important."; $message = "Entry {$entry_id} has been starred as important. Please review this entry."; wp_mail( $to, $subject, $message ); }}
Placement
This code should be placed in the functions.php file of your active theme.
Source Code
This filter is located in GFFormsModel::update_lead_property() in forms_model.php.