GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
other_entries.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Display other entries created by the entry creator field type
4  *
5  * @package GravityView
6  * @subpackage GravityView/templates/fields
7  */
8 
10 
11 $field = $gravityview_view->getCurrentField();
12 
13 $created_by = \GV\Utils::get( $field, 'entry/created_by' );
14 
15 // There was no logged in user who created this entry.
16 if( empty( $created_by ) ) {
17  return;
18 }
19 
20 $form_id = $gravityview_view->getFormId();
21 
22 // Get the settings for the View ID
24 
25 $view_settings['page_size'] = $gravityview_view->getCurrentFieldSetting('page_size');
26 
27 // Prepare paging criteria
28 $criteria['paging'] = array(
29  'offset' => 0,
30  'page_size' => $view_settings['page_size']
31 );
32 
33 // Prepare Search Criteria
34 $criteria['search_criteria'] = array(
35  'field_filters' => array(
36  array(
37  'key' => 'created_by',
38  'value' => $created_by,
39  'operator' => 'is'
40  )
41  )
42 );
44 $criteria['search_criteria']['status'] = apply_filters( 'gravityview_status', 'active', $view_settings );
45 
46 /**
47  * Modify the search parameters before the entries are fetched
48  *
49  * @since 1.11
50  *
51  * @param array $criteria Gravity Forms search criteria array, as used by GVCommon::get_entries()
52  * @param array $view_settings Associative array of settings with plugin defaults used if not set by the View
53  * @param int $form_id The Gravity Forms ID
54  */
55 $criteria = apply_filters('gravityview/field/other_entries/criteria', $criteria, $view_settings, $form_id );
56 
58 
59 // Don't show if no entries and the setting says so
60 if( empty( $entries ) && $gravityview_view->getCurrentFieldSetting('no_entries_hide') ) {
61  return;
62 }
63 
64 // If there are search results, get the entry list object
66  $entries,
67  $gravityview_view->getPostId(),
68  $field['form'],
69  $gravityview_view->getCurrentFieldSetting('link_format'),
70  $gravityview_view->getCurrentFieldSetting('after_link'),
71  'other_entries' // Context
72 );
73 
74 // Generate and echo the output
75 $list->output();
76 
77 /**
78  * @since 1.7.6
79  * @deprecated since 1.11
80  */
81 $deprecated = apply_filters( 'gravityview/field/other_entries/args', array(), $field );
82 if ( !empty( $deprecated ) ) {
83  _deprecated_function( 'The "gravityview/field/other_entries/args" filter', 'GravityView 1.11', 'gravityview/field/other_entries/criteria' );
84 }
static getInstance( $passed_post=NULL)
if(empty( $entries) && $gravityview_view->getCurrentFieldSetting('no_entries_hide')) $list
If this file is called directly, abort.
static process_search_only_approved( $args, $search_criteria)
Process the approved only search criteria according to the View settings.
$deprecated
gravityview_get_template_settings( $post_id)
Get all the settings for a View.
$entries
$view_settings
$criteria['paging']
Modify the search parameters before the entries are fetched.
$field
static get_entries( $form_ids=null, $passed_criteria=null, &$total=null)
Retrieve entries given search, sort, paging criteria.
$created_by
$gravityview_view
if(empty( $created_by)) $form_id
static get( $array, $key, $default=null)
Grab a value from an array or an object or default.