gravityflowformconnector_update_entry_approval_status

Description

The filter gravityflowformconnector_update_entry_approval_status can be used for setting the approval status without having to use a field on the form to define the status.

Parameters

ParameterTypeDefinition
$statusstringThe status of the target step.
$target_entry_idIntegerThe ID of the target entry.
$target_form_idIntegerThe Id of the target form
$entryEntry ObjectThe current entry
$formForm ObjectThe current form.
$stepStepThe current workflow step.

Examples

Set the status of the Approval step to Approved?

Accepts the ID of an Approval step ”the_step_id’ and sets it’s Status to Approved

add_filter('gravityflowformconnector_update_entry_approval_status', 'gf_set_approval_status', 10, 6);
function gf_set_approval_status( $status, $target_entry_id, $target_form_id, $entry, $form, $step) {
    if ( in_array( $step->get_id(), array( 'the_step_id' ) ) ) {
        $status = 'approved';
    }
    
    return $status;
}

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?