Using Gravity Forms ‘gform_post_update_entry_property’ PHP action

The gform_post_update_entry_property Gravity Forms action runs after an entry property is updated.

Usage

add_action('gform_post_update_entry_property', 'your_function_name', 10, 4);

Parameters

  • $entry_id (int) – The current entry ID.
  • $property_name (string) – The property that was updated.
  • $property_value (string) – The new value of the property that was updated.
  • $previous_value (string) – The previous property value before the update.

More information

See Gravity Forms Docs: gform_post_update_entry_property

This action was added in Gravity Forms version 2.3.3.9.

Source code location: GFFormsModel::update_entry_property() in forms_model.php.

Examples

Prevent entries from being trashed

add_action('gform_post_update_entry_property', 'after_entry_property_updated', 10, 4);
function after_entry_property_updated($entry_id, $property_name, $property_value, $previous_value) {
    if ($property_name == 'status' && $property_value == 'trash') {
        GFFormsModel::update_entry_property($entry_id, 'status', 'active');
    }
}

Update entry title after property change

add_action('gform_post_update_entry_property', 'update_entry_title', 10, 4);
function update_entry_title($entry_id, $property_name, $property_value, $previous_value) {
    if ($property_name == 'title') {
        GFFormsModel::update_entry_property($entry_id, 'title', strtoupper($property_value));
    }
}

Log property updates

add_action('gform_post_update_entry_property', 'log_property_updates', 10, 4);
function log_property_updates($entry_id, $property_name, $property_value, $previous_value) {
    error_log("Entry {$entry_id} property '{$property_name}' updated from '{$previous_value}' to '{$property_value}'.");
}

Send notification on property update

add_action('gform_post_update_entry_property', 'send_notification_on_property_update', 10, 4);
function send_notification_on_property_update($entry_id, $property_name, $property_value, $previous_value) {
    if ($property_name == 'status' && $property_value == 'approved') {
        $entry = GFAPI::get_entry($entry_id);
        $form = GFAPI::get_form($entry['form_id']);
        GFCommon::send_notification('approval', $form, $entry);
    }
}

Add a note after property update

add_action('gform_post_update_entry_property', 'add_note_after_property_update', 10, 4);
function add_note_after_property_update($entry_id, $property_name, $property_value, $previous_value) {
    if ($property_name == 'status') {
        $note = "Status changed from '{$previous_value}' to '{$property_value}'.";
        GFFormsModel::add_note($entry_id, '0', '0', $note);
    }
}