You shouldn’t buy this!

In 2021, Gravity Wiz contracted me to fork this plugin. Since then, they’ve launched Gravity Perks Google Sheets, and you should buy that instead. It’s way better, and I helped build it. Check out the software I offer now or hire me to build the plugin you need at I am listed on the Gravity Wiz Recommended Developers page.

Corey Salzano

How to sort by multiple fields in GFAPI::get_entries()

You can’t. It’s not possible in Gravity Forms 2.4. Use the code sample below instead.

The third parameter to get_entries() is not designed to accept more than one sort field. Use array_multisort() to sort the array output of get_entries() like this:

$entries = GFAPI::get_entries( 22, '', null );
//form #22 Tournament team registration 

$sort = array();
foreach( $entries as $k => $v )
	//Build an array full of the fields we want to sort $entries by
	$sort['is_approved'][$k] = $v['is_approved'];
	$sort['16'][$k] = $v['16']; //field #16 Company name

//Sort $entries by is_approved descending, then field 16 ascending
array_multisort( $sort['is_approved'], SORT_DESC, $sort['16'], SORT_ASC, $entries );