gravityflow_validation_user_input

The gravityflow_validation_user_input is used to validate whether the user input step form is valid. You might use it when you require an equivalent to gform_validation. Note that gform_field_validation does fire for user input steps and is generally the better filter to hook your custom logic to.

Parameters

$validation_result array
The validation result and form currently being processed

$step object
The current user input step

$new_status string
The new status for the current step

Examples

Example 1 - Prevent users with specific meta data from completing a user input

add_filter( 'gravityflow_validation_user_input', 'sh_custom_user_input_validation', 10,3 );

function sh_custom_user_input_validation( $validation_result, $step, $new_status ) {

    $current_user = wp_get_current_user();
    if ( 0 !== $current_user->ID ) {
        $level = get_user_meta( $current_user->ID, 'employee_level', true );
        if ( isset( $level ) && (int) $level < 5 ) {
            return new WP_Error( 'validation_result', esc_html__( 'Only Level 5+ employees can complete this step', 'gravityflow' ), $validation_result );
        }
    }

    return $validation_result;
}


Placement

This code should be placed in the functions.php file of your active theme.