Skip to content

Instantly share code, notes, and snippets.

@noameppel
Created August 20, 2015 03:50
Show Gist options
  • Save noameppel/a7a7c7993ad0135d2eb4 to your computer and use it in GitHub Desktop.
Save noameppel/a7a7c7993ad0135d2eb4 to your computer and use it in GitHub Desktop.
Searches GravityForm Entries. Uses get_entries()
<?php
/**
* [display_user_application_form]
* Searches GravityForm Entries. Uses get_entries()
* Will display form results where do_action( 'form-display', $arg = '' ); is in the template.
* https://www.gravityhelp.com/documentation/article/api-functions/#get_entries
*/
function display_user_application_form() {
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
'mode' => 'all',
array(
'key' => 'form_id',
'value' => '10'
),
array(
'key' => 'created_by',
'value' => get_current_user_id()
)
)
);
$getforms = GFAPI::get_entries(0, $search_criteria);
echo '<h3>Displaying Form for User ' . get_current_user_id() . '</h3>';
echo "<pre>";
var_dump($getforms);
echo "</pre>";
}
add_action('form-display', 'display_user_application_form');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment