gravityflow_status_filter
The gravityflow_status_filter filter is used to constrain the entries on the status page.
Parameters
$filter_constraints array
Example
The following snippet will restrict user with the ID of 1 to the entries of form 2.
add_filter( 'gravityflow_status_filter', 'sh_gravityflow_status_filter' ); function sh_gravityflow_status_filter( $filter_constraints ) { $user = wp_get_current_user(); if ( $user->ID == 1 ) { // The constraints are optional. $filter_constraints = array( 'form_id' => 2, // 'start_date' => '2016-01-01', // 'end_date' => '2016-01-14', ); } return $filter_constraints; }
The following snippet will restrict any entries with a value of Ontario in field 9. Refer to the Gravity Forms API docs for further field filter examples.
add_filter( 'gravityflow_status_filter', 'sh_gravityflow_status_field_filter' ); function sh_gravityflow_status_field_filter( $filter_constraints ) { $filter_constraints = array( 'field_filters' => array( 'mode' => 'all', array( 'key' => 9, 'operator' => 'isnot', 'value' => 'Ontario' ) ) ); return $filter_constraints; }
When working with shortcodes, the filter must be specified with the form_id to ensure the shortcode works in collaboration with it. For the shortcode : [gravityflow page="status" form="5" fields="1,2" id_column="false"], where we restrict status view to have values of fields of 1 and 2 only. A further requirement of only displaying the fields with value in field 1 as 'Hello' will be done as shown below. Please note without specifying the form_id in filter, it will work to process the data of all forms.
add_filter( 'gravityflow_status_filter','sh_gravityflow_status_field_filter' ); function sh_gravityflow_status_field_filter( $filter_constraints ) { $filter_constraints = array( 'field_filters' => array( 'mode' => 'all', array( 'key' => 1, 'operator' => 'is', 'value' => 'Hello' ) ), 'form_id' => 5 ); return $filter_constraints; }
Placement
This code should be placed in the functions.php file of your active theme.