gravityflow_bulk_action_status_table

Description

The gravityflow_bulk_action_status_table filter allows custom bulk actions to be processed on the Status table

Parameters

ParameterTypeDetails
$feedbackString or WP_ErrorThe admin message.
$bulk_actionStringThe action.
$entry_idsArrayThe entry IDs to be processed.
$argsArrayThe args for this table.

Examples

Perform a bulk action for entries in the status table

Use in conjunction with the gravityflow_status_args filter to modify the bulk actions available to the status table shown via block or shortcode, this filter could execute a custom bulk action.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
add_filter( 'gravityflow_bulk_action_status_table', 'filter_gravityflow_bulk_action_status_table', 10, 4 );
function filter_gravityflow_bulk_action_status_table( $feedback, $bulk_action, $entry_ids, $args ) {
 
    // Process the bulk action and return some feedback to the user
    if($bulk_action == 'cancel_workflow') {
        foreach($entry_ids as $entry_id ){
            $entry = GFAPI::get_entry( $entry_id );
            $api = new Gravity_Flow_API( $entry['form_id'] );
            $status = $api->cancel_workflow( $entry );          
        }
         
        $feedback = 'Selected entries cancelled successfully';
         
    }

Placement

This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.

See also the PHP section in this article: Where Do I Put This Code?