bookmark_bordergform_search_criteria_entry_list

Description

Use this filter modify search criteria used retrieve entries for display on the Entry List page.

Usage

The following would apply to all forms.

add_filter( 'gform_search_criteria_entry_list', 'your_function_name' );

To limit the scope of your function to a specific form, append the form id to the end of the hook name. (format: gform_search_criteria_entry_list_FORMID)

add_filter( 'gform_search_criteria_entry_list_6', 'your_function_name' );

Parameters

  • $search_criteria array

    An array containing the search criteria. The search criteria array is constructed as follows:

    Filter by status

    $search_criteria['status'] = 'active';

    Filter by any column in the main table

    $search_criteria['field_filters'][] = array( 'key' => 'currency', 'value' => 'USD' );
    $search_criteria['field_filters'][] = array( 'key' => 'is_read', 'value' => true );
    ‚Äč$search_criteria['field_filters'][] = array( 'key' => 'created_by', 'value' => $current_user->ID );
    

    Filter by date range

    $search_criteria['start_date'] = $start_date;
    $search_criteria['end_date'] = $end_date;
    

    Filter by Field Values

    $search_criteria['field_filters'][] = array( 'key' => '1', 'value' => 'gquiz159982170' );
    

    Filter Operators

    // Supported operators for scalar values: is/=, isnot, contains
    $search_criteria['field_filters'][] = array( 'key' => '1', 'operator' => 'contains', 'value' => 'Steve' );
    // Supported operators for array values: in/=, not in/!=
    $search_criteria['field_filters'][] = array( 'key' => '1', 'operator' => 'not in', 'value' => array( 'Alex', 'David', 'Dana' );
    

    Filter by a checkbox value (not recommended)

    $search_criteria['field_filters'][] = array( 'key' => '2.2', 'value' => 'gquiz246fec995' );
    

    Note: this will work for checkboxes but it won’t work if the checkboxes have been re-ordered – best to use the following example below

    Filter by a checkbox value (recommended)

    $search_criteria['field_filters'][] = array( 'key' => '2', 'value' => 'gquiz246fec995' );
    $search_criteria['field_filters'][] = array( 'key' => '2', 'operator' => 'not in', 'value' => array( 'First Choice', 'Third Choice' ) );
    

    Filter by a global/free-form search of values of any form field

    $search_criteria['field_filters'][] = array( 'value' => $search_value );
    // OR
    $search_criteria['field_filters'][] = array( 'key' => 0, 'value' => $search_value );
    

    Filter entries by Entry meta (added using the gform_entry_meta hook)

    $search_criteria['field_filters'][] = array( 'key' => 'gquiz_score', 'value' => '1' );
    $search_criteria['field_filters'][] = array( 'key' => 'gquiz_is_pass', 'value' => '1' );
    

    Filter by ALL / ANY of the field filters

    $search_criteria['field_filters']['mode'] = 'all'; // default
    $search_criteria['field_filters']['mode'] = 'any';
    

  • $form_id integer

    The ID of the current form.

Examples

1. Entries created by the current user.

The following example shows how you can configure the search to only return entries submitted by the current user.

add_filter( 'gform_search_criteria_entry_list', 'override_search_criteria' );
function override_search_criteria( $search_criteria ) {
    $search_criteria['field_filters'][] = array( 'key' => 'created_by', 'operator' => 'is', 'value' => get_current_user_id() );

    return $search_criteria;
}

Since

This filter was added in Gravity Forms 1.9.14.30.

Source Code

This filter is located in GFEntryList::leads_page() in entry_list.php, GFEntryDetail::lead_detail_page in entry_detail.php, and print-entry.php