The gform_confirmation_actions is an action in Gravity Forms that allows you to modify the list of actions which display below the Confirmation Name on the Confirmations list view.
Usage
To use this action, you need to use add_action
function with it. Here’s a generic example:
add_action( 'gform_confirmation_actions', 'my_custom_function' ); function my_custom_function($actions) { // your custom code here return $actions; }
Parameters
- $actions (array): An array of current confirmation actions.
More information
For more details, visit Gravity Forms Docs: gform_confirmation_actions
This action is located in the GFConfirmationTable::column_name() function in form_settings.php file.
Examples
Adding a ‘duplicate’ action
In this example, we are adding a ‘duplicate’ action. This action will not actually duplicate the form as the myCustomDuplicateConfirmationFunction()
function doesn’t exist.
add_action( 'gform_confirmation_actions', 'my_custom_confirmation_action' ); function my_custom_confirmation_action( $actions ) { // adds a 'duplicate' action with a link that triggers some functionality on click $actions['duplicate'] = '<a href="javascript:void(0)" onclick="myCustomDuplicateConfirmationFunction();">Duplicate</a>'; return $actions; }
Removing an action
This code removes a specific action from the confirmations.
add_action( 'gform_confirmation_actions', 'remove_specific_action' ); function remove_specific_action( $actions ) { unset($actions['specific_action']); // replace 'specific_action' with the action you want to remove return $actions; }
Adding a new action with custom functionality
This example adds a new action that triggers a JavaScript alert.
add_action( 'gform_confirmation_actions', 'add_alert_action' ); function add_alert_action( $actions ) { $actions['alert'] = '<a href="javascript:void(0)" onclick="alert(\'This is a custom action!\');">Alert</a>'; return $actions; }
Modifying an existing action
This code modifies the ‘duplicate’ action to show a custom message.
add_action( 'gform_confirmation_actions', 'modify_duplicate_action' ); function modify_duplicate_action( $actions ) { if (isset($actions['duplicate'])) { $actions['duplicate'] = '<a href="javascript:void(0)" onclick="alert(\'Duplicate action has been modified!\');">Modified Duplicate</a>'; } return $actions; }
Clear all actions
This example clears all actions from the confirmations.
add_action( 'gform_confirmation_actions', 'clear_all_actions' ); function clear_all_actions( $actions ) { return []; }