gravityflow_note_valid

Description

The gravityflow_note_valid filter is used to customize if a workflow note is valid or not.

Parameters

ParameterTypeDetails
$validBooleanIndicates if the note is valid.
$noteStringThe submitted note.
$new_statusStringThe new status for the current step.
$stepStepThe current workflow step.

Examples

Only a specific workflow note text will be acceptable

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
add_filter( 'gravityflow_note_valid', 'my_gravityflow_note_valid', 10, 4 );
function my_gravityflow_note_valid( $valid, $note, $new_status, $step ) {
     
    // for a particular step, only a specific note can make the step note acceptable
    if ( $step->get_id() == 74 ) {
        if ( $note == 'Accepted' ) {
            $valid = true;
        }
        else {
            $valid = false;
        }
    }
 
    return $valid;
}

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?