Using Gravity Forms ‘gform_notification_actions’ PHP filter

The gform_notification_actions filter allows you to modify the list of actions displayed below the Notification Name on the Notifications list view in Gravity Forms.

Usage

add_filter('gform_notification_actions', 'my_custom_function');

Parameters

  • $actions (array): An array of the current notification actions.

More information

See Gravity Forms Docs: gform_notification_actions

Examples

Add a custom ‘Duplicate’ action

This example demonstrates how to add a custom ‘Duplicate’ action to the notifications list. Please note that the myCustomDuplicateNotificationFunction() does not exist, so the form will not actually be duplicated if you add this code sample.

function my_custom_notification_action($actions) {
    // Adds a 'duplicate' action with a link that triggers some functionality on click
    $actions['duplicate'] = '<a href="javascript:void(0)" onclick="myCustomDuplicateNotificationFunction();">Duplicate</a>';

    return $actions;
}
add_filter('gform_notification_actions', 'my_custom_notification_action');

Remove a specific action

This example demonstrates how to remove the ‘Edit’ action from the notifications list.

function remove_edit_notification_action($actions) {
    unset($actions['edit']);

    return $actions;
}
add_filter('gform_notification_actions', 'remove_edit_notification_action');

Add a custom ‘Archive’ action

This example shows how to add a custom ‘Archive’ action to the notifications list.

function add_archive_notification_action($actions) {
    $actions['archive'] = '<a href="javascript:void(0)" onclick="myCustomArchiveNotificationFunction();">Archive</a>';

    return $actions;
}
add_filter('gform_notification_actions', 'add_archive_notification_action');

Modify the ‘Delete’ action

This example demonstrates how to modify the ‘Delete’ action in the notifications list.

function modify_delete_notification_action($actions) {
    $actions['delete'] = '<a href="javascript:void(0)" onclick="myCustomDeleteNotificationFunction();">Custom Delete</a>';

    return $actions;
}
add_filter('gform_notification_actions', 'modify_delete_notification_action');

Change the order of actions

This example shows how to change the order of actions in the notifications list.

function change_notification_actions_order($actions) {
    // Move the 'Edit' action to the end
    $edit_action = $actions['edit'];
    unset($actions['edit']);
    $actions['edit'] = $edit_action;

    return $actions;
}
add_filter('gform_notification_actions', 'change_notification_actions_order');