Using Gravity Forms ‘gform_updates’ PHP action

The gform_updates action is triggered after the display of the update or invalid key notice for Gravity Forms.

Usage

add_action('gform_updates', 'my_custom_function', 10, 0);

Parameters

There are no parameters available for this action.

More information

See Gravity Forms Docs: gform_updates

This action hook is located in update.php.

Examples

Display a custom message after the update notice

In this example, a custom message will be displayed after the update notice for Gravity Forms.

function display_custom_message() {
    echo 'Please make sure your license key is valid for uninterrupted service.';
}
add_action('gform_updates', 'display_custom_message', 10, 0);

Log update notice display

Log the date and time when the update notice is displayed.

function log_update_notice() {
    error_log('Gravity Forms update notice displayed: ' . current_time('mysql'));
}
add_action('gform_updates', 'log_update_notice', 10, 0);

Send an email notification when the update notice is displayed

Send an email to the administrator when the update notice is displayed.

function send_email_notification() {
    $to = get_option('admin_email');
    $subject = 'Gravity Forms Update Notice';
    $message = 'An update notice has been displayed on your website.';
    wp_mail($to, $subject, $message);
}
add_action('gform_updates', 'send_email_notification', 10, 0);

Add custom CSS to the update notice

Add custom CSS to style the update notice.

function add_custom_css_to_update_notice() {
    echo '<style>.gforms_update_notice {background-color: #f9edbe;}</style>';
}
add_action('gform_updates', 'add_custom_css_to_update_notice', 10, 0);

Redirect users to a custom page after the update notice is displayed

Redirect users to a custom page when the update notice is displayed.

function redirect_to_custom_page() {
    $redirect_url = 'https://example.com/custom-page';
    echo '<script>setTimeout(function() { window.location.href = "' . $redirect_url . '"; }, 5000);</script>';
}
add_action('gform_updates', 'redirect_to_custom_page', 10, 0);