gravityflow_form_ids_status

Description

The gravityflow_form_ids_status filter constrains which forms’ entries are displayed via the status page or admin view.

Parameters

ParameterTypeDetails
$form_idsArrayThe form ids that the current status page is meant to display.
$search_criteriaArrayThe search criteria that will be applied to entries for this status page.

Examples

Prevent entries from specific form(s) from displaying on the status page

1
2
3
4
5
6
7
8
add_filter( 'gravityflow_form_ids_status', 'sh_status_form_ids_limit', 10, 2 );
function sh_status_form_ids_limit( $form_ids, $search_criteria ) {
 
    unset( $form_ids[ array_search( 1, $form_ids ) ] );
    $form_ids = array_values( $form_ids );
 
    return $form_ids;
}

Limit the display to entries from specific forms

1
2
3
4
5
6
add_filter( 'gravityflow_form_ids_status', 'sh_status_form_ids_explicit', 10, 2 );
function sh_status_form_ids_explicit( $form_ids, $search_criteria ) {
    //Adjust array to your desired form IDs.
    $form_ids = array ( 1, 6 );
    return $form_ids;
}

Limit the display to entries from a specific form for non-administrative users

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
add_filter( 'gravityflow_form_ids_status', 'sh_status_form_ids_explicit', 10, 2 );
function sh_status_form_ids_explicit( $form_ids, $search_criteria ) {
    $filtered_form_ids = array ( 14 );
 
    $current_user = wp_get_current_user();
    if ( ! ( $current_user instanceof WP_User ) ) {
        return $filtered_form_ids;
    }
 
    if (isset( $current_user->roles ) && ! empty( $current_user->roles && in_array( 'administrator', $current_user->roles ) ) ) {
        return $form_ids;
    }
 
    return $filtered_form_ids;
}

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?