gravityflow_sort_criteria_status

Available as of Gravity Flow 2.7

The gravityflow_sort_criteria_status filter allows the initial sort order on status page load to be defined.

Parameters

Parameter Type Definition
$array Array The sort criteria for the status page.

Examples

Example 1 - Change the default sort to match based on a custom meta column

A custom meta column, defined through gform_entry_meta, would also use gravityflow_columns_status_table to display the custom column,  gravityflow_field_value_status_table to display the custom meta value in the column, along with gravityflow_sort_columns_status_table to define that column

add_filter( 'gravityflow_sort_criteria_status', 'sort_criteria_status' );
function sort_criteria_status( $sort_criteria ) {
    //Adjust to only have the default filter execute on your desired page(s)
    if ( ! is_page( '94' ) ) {
        return $sort_criteria;
    }

    //Ensure that if the user has clicked on a sort column header this filter won't override that
    if ( ! rgget( 'orderby' ) && ! rgget( 'order' ) ) {
        //Modify the key attribute to match the field/custom column you wish to sort by.
        $sort_criteria['key'] = 'priority';
        $sort_criteria['direction'] = 'DESC';
        $sort_criteria['is_numeric'] = true;
    }
    return $sort_criteria;
}

Placement

This code should be placed in the functions.php file of your active theme or in a custom functions plugin.