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
Parameter | Type | Definition |
---|---|---|
$status | string | The status of the target step. |
$target_entry_id | Integer | The ID of the target entry. |
$target_form_id | Integer | The Id of the target form |
$entry | Entry Object | The current entry |
$form | Form Object | The current form. |
$step | Step | The 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?