GravityView  2.1.1
The best, easiest way to display Gravity Forms entries on your website.
class-admin-approve-entries.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @file class-admin-approve-entries.php
4  * @package GravityView
5  * @license GPL2+
6  * @author Katz Web Services, Inc.
7  * @link http://gravityview.co
8  * @copyright Copyright 2014, Katz Web Services, Inc.
9  *
10  * @since 1.0.0
11  */
12 
13 
14 
16 
17  // hold notification messages
18  public $bulk_update_message = '';
19 
20  /**
21  * @var array Set the prefixes here instead of spread across the class
22  * @since 1.17
23  */
24  private $bulk_action_prefixes = array(
25  'approve' => 'gvapprove',
26  'disapprove' => 'gvdisapprove',
27  'unapprove' => 'gvunapprove',
28  );
29 
30  function __construct() {
31 
32  $this->add_hooks();
33 
34  }
35 
36  private function add_hooks() {
37  /** Edit Gravity Form page */
38 
39  // Add button to left menu
40  add_filter( 'gform_add_field_buttons', array( $this, 'add_field_buttons' ) );
41  // Set defaults
42  add_action( 'gform_editor_js_set_default_values', array( $this, 'set_defaults' ) );
43 
44  /** gf_entries page - entries table screen */
45 
46  // capture bulk actions
47  add_action( 'gform_loaded', array( $this, 'process_bulk_action') );
48 
49  // add hidden field with approve status
50  add_action( 'gform_entries_first_column_actions', array( $this, 'add_entry_approved_hidden_input' ), 1, 5 );
51 
52  add_filter( 'gravityview/metaboxes/tooltips', array( $this, 'tooltips' ) );
53 
54  // adding styles and scripts
55  add_action( 'admin_enqueue_scripts', array( $this, 'add_scripts_and_styles') );
56  // bypass Gravity Forms no-conflict mode
57  add_filter( 'gform_noconflict_scripts', array( $this, 'register_gform_noconflict_script' ) );
58  add_filter( 'gform_noconflict_styles', array( $this, 'register_gform_noconflict_style' ) );
59 
60  add_filter( 'gform_filter_links_entry_list', array( $this, 'filter_links_entry_list' ), 10, 3 );
61  }
62 
63  /**
64  * Add filter links to the Entries page
65  *
66  * Can be disabled by returning false on the `gravityview/approve_entries/show_filter_links_entry_list` filter
67  *
68  * @since 1.17.1
69  *
70  * @param array $filter_links Array of links to include in the subsubsub filter list. Includes `id`, `field_filters`, `count`, and `label` keys
71  * @param array $form GF Form object of current form
72  * @param bool $include_counts Whether to include counts in the output
73  *
74  * @return array Filter links, with GravityView approved/disapproved links added
75  */
76  public function filter_links_entry_list( $filter_links = array(), $form = array(), $include_counts = true ) {
77 
78  /**
79  * @filter `gravityview/approve_entries/show_filter_links_entry_list` Disable filter links
80  * @since 1.17.1
81  * @param bool $show_filter_links True: show the "approved"/"disapproved" filter links. False: hide them.
82  * @param array $form GF Form object of current form
83  */
84  if( false === apply_filters( 'gravityview/approve_entries/show_filter_links_entry_list', true, $form ) ) {
85  return $filter_links;
86  }
87 
88  $field_filters_approved = array(
89  array(
92  ),
93  );
94 
95  $field_filters_disapproved = array(
96  array(
99  ),
100  );
101 
102  $field_filters_unapproved = array(
103  array(
106  ),
107  );
108 
109  $approved_count = $disapproved_count = $unapproved_count = 0;
110 
111  // Only count if necessary
112  if( $include_counts ) {
113  $approved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_approved ) ) );
114  $disapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_disapproved ) ) );
115  $unapproved_count = count( gravityview_get_entry_ids( $form['id'], array( 'status' => 'active', 'field_filters' => $field_filters_unapproved ) ) );
116  }
117 
118  $filter_links[] = array(
119  'id' => 'gv_approved',
120  'field_filters' => $field_filters_approved,
121  'count' => $approved_count,
123  );
124 
125  $filter_links[] = array(
126  'id' => 'gv_disapproved',
127  'field_filters' => $field_filters_disapproved,
128  'count' => $disapproved_count,
130  );
131 
132  $filter_links[] = array(
133  'id' => 'gv_unapproved',
134  'field_filters' => $field_filters_unapproved,
135  'count' => $unapproved_count,
137  );
138 
139  return $filter_links;
140  }
141 
142  /**
143  * Add the GravityView Fields group tooltip
144  *
145  * @param $tooltips
146  *
147  * @return array Tooltips array with GravityView fields tooltip
148  */
149  function tooltips( $tooltips ) {
150 
151  $tooltips['form_gravityview_fields'] = array(
152  'title' => __('GravityView Fields', 'gravityview'),
153  'value' => __( 'Allow administrators to approve or reject entries and users to opt-in or opt-out of their entries being displayed.', 'gravityview'),
154  );
155 
156  return $tooltips;
157  }
158 
159 
160  /**
161  * Inject new add field buttons in the gravity form editor page
162  *
163  * @access public
164  * @param mixed $field_groups
165  * @return array Array of fields
166  */
167  function add_field_buttons( $field_groups ) {
168 
169  $gravityview_fields = array(
170  'name' => 'gravityview_fields',
171  'label' => 'GravityView',
172  'fields' => array(
173  array(
174  'class' => 'button',
175  'value' => __( 'Approve/Reject', 'gravityview' ),
176  'onclick' => "StartAddField('gravityviewapproved_admin');",
177  'data-type' => 'gravityviewapproved_admin'
178  ),
179  array(
180  'class' => 'button',
181  'value' => __( 'User Opt-In', 'gravityview' ),
182  'onclick' => "StartAddField('gravityviewapproved');",
183  'data-type' => 'gravityviewapproved'
184  ),
185  )
186  );
187 
188  array_push( $field_groups, $gravityview_fields );
189 
190  return $field_groups;
191  }
192 
193 
194 
195  /**
196  * At edit form page, set the field Approve defaults
197  *
198  * @todo Convert to a partial include file
199  * @access public
200  * @return void
201  */
202  function set_defaults() {
203  ?>
204  case 'gravityviewapproved_admin':
205  field.label = "<?php echo esc_js( __( 'Approved? (Admin-only)', 'gravityview' ) ); ?>";
206 
207  field.adminLabel = "<?php echo esc_js( __( 'Approved?', 'gravityview' ) ); ?>";
208  field.adminOnly = true;
209 
210  field.choices = null;
211  field.inputs = null;
212 
213  if( !field.choices ) {
214  field.choices = new Array( new Choice("<?php echo esc_js( GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ) ); ?>") );
215  }
216 
217  field.inputs = new Array();
218  for( var i=1; i<=field.choices.length; i++ ) {
219  field.inputs.push(new Input(field.id + (i/10), field.choices[i-1].text));
220  }
221 
222  field.type = 'checkbox';
223  field.gravityview_approved = 1;
224 
225  break;
226  case 'gravityviewapproved':
227  field.label = "<?php echo esc_js( __( 'Show Entry on Website', 'gravityview' ) ); ?>";
228 
229  field.adminLabel = "<?php echo esc_js( __( 'Opt-In', 'gravityview' ) ); ?>";
230  field.adminOnly = false;
231 
232  field.choices = null;
233  field.inputs = null;
234 
235  if( !field.choices ) {
236  field.choices = new Array(
237  new Choice("<?php echo esc_js( __( 'Yes, display my entry on the website', 'gravityview' ) ); ?>")
238  );
239  }
240 
241  field.inputs = new Array();
242  for( var i=1; i<=field.choices.length; i++ ) {
243  field.inputs.push(new Input(field.id + (i/10), field.choices[i-1].text));
244  }
245 
246  field.type = 'checkbox';
247  field.gravityview_approved = 1;
248 
249  break;
250  <?php
251  }
252 
253  /**
254  * Get the Bulk Action submitted value if it is a GravityView Approve/Unapprove action
255  *
256  * @since 1.17.1
257  *
258  * @return string|false If the bulk action was GravityView Approve/Unapprove, return the full string (gvapprove-16, gvunapprove-16). Otherwise, return false.
259  */
260  private function get_gv_bulk_action() {
261 
262  $gv_bulk_action = false;
263 
264  if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
265  $bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' );
266  } else {
267  // GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
268  $bulk_action = \GV\Utils::_POST( 'bulk_action' ) ? \GV\Utils::_POST( 'bulk_action' ) : \GV\Utils::_POST( 'bulk_action2' );
269  }
270 
271  // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
272  if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
273  $gv_bulk_action = $bulk_action;
274  }
275 
276  return $gv_bulk_action;
277  }
278 
279  /**
280  * Capture bulk actions - gf_entries table
281  *
282  * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request.
283  * @access public
284  * @return void|boolean
285  */
286  public function process_bulk_action() {
287 
288  if ( ! is_admin() || ! class_exists( 'GFForms' ) || empty( $_POST ) ) {
289  return false;
290  }
291 
292  // The action is formatted like: gvapprove-16 or gvunapprove-16, where the first word is the name of the action and the second is the ID of the form.
293  $bulk_action = $this->get_gv_bulk_action();
294 
295  // gforms_entry_list is the nonce that confirms we're on the right page
296  // gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
297  if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) {
298 
299  check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
300 
301  /**
302  * The extra '-' is to make sure that there are at *least* two items in array.
303  * @see https://github.com/katzwebservices/GravityView/issues/370
304  */
305  $bulk_action .= '-';
306 
307  list( $approved_status, $form_id ) = explode( '-', $bulk_action );
308 
309  if ( empty( $form_id ) ) {
310  gravityview()->log->error( 'Form ID is empty from parsing bulk action.', array( 'data' => $bulk_action ) );
311  return false;
312  }
313 
314  // All entries are set to be updated, not just the visible ones
315  if ( ! empty( $_POST['all_entries'] ) ) {
316 
317  // Convert the current entry search into GF-formatted search criteria
318  $search = array(
319  'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
320  'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
321  'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
322  );
323 
325 
326  // Get all the entry IDs for the form
328 
329  } else {
330 
331  // Changed from 'lead' to 'entry' in 2.0
332  $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
333 
334  }
335 
336  if ( empty( $entries ) ) {
337  gravityview()->log->error( 'Entries are empty' );
338  return false;
339  }
340 
341  $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
342 
343  switch ( $approved_status ) {
344  case $this->bulk_action_prefixes['approve']:
346  $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
347  break;
348  case $this->bulk_action_prefixes['unapprove']:
350  $this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count );
351  break;
352  case $this->bulk_action_prefixes['disapprove']:
354  $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
355  break;
356  }
357  }
358  }
359 
360 
361  /**
362  * update_approved function.
363  *
364  * @since 1.18 Moved to GravityView_Entry_Approval::update_approved
365  * @see GravityView_Entry_Approval::update_approved
366  *
367  * @param int $entry_id (default: 0)
368  * @param int $approved (default: 0)
369  * @param int $form_id (default: 0)
370  * @param int $approvedcolumn (default: 0)
371  *
372  * @return boolean True: It worked; False: it failed
373  */
374  public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
375  return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn );
376  }
377 
378  /**
379  * Calculate the approve field.input id
380  *
381  * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column
382  * @see GravityView_Entry_Approval::get_approved_column
383  *
384  * @param mixed $form GF Form or Form ID
385  * @return false|null|string Returns the input ID of the approved field. Returns NULL if no approved fields were found. Returns false if $form_id wasn't set.
386  */
387  static public function get_approved_column( $form ) {
388  return GravityView_Entry_Approval::get_approved_column( $form );
389  }
390 
391  /**
392  * Add a hidden input that is used in the Javascript to show approved/disapproved entries checkbox
393  *
394  * See the /assets/js/admin-entries-list.js setInitialApprovedEntries method
395  *
396  * @param $form_id
397  * @param $field_id
398  * @param $value
399  * @param $entry
400  * @param $query_string
401  *
402  * @return void
403  */
404  static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
405 
406  if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
407  return;
408  }
409 
410  if( empty( $entry['id'] ) ) {
411  return;
412  }
413 
414  $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' );
415 
416  if( $status_value ) {
417  echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />';
418  }
419  }
420 
421  /**
422  * Get the form ID of the form currently being displayed
423  *
424  * @since 1.17.1
425  *
426  * @return int ID of the current form being displayed. `0` is returned if no forms are found.
427  */
428  private function get_form_id() {
429 
430  $form_id = GFForms::get('id');
431 
432  // If there are no forms identified, use the first form. That's how GF does it.
433  if( empty( $form_id ) && class_exists('RGFormsModel') ) {
434  $form_id = $this->get_first_form_id();
435  }
436 
437  return absint( $form_id );
438  }
439 
440  /**
441  * Get the first form ID from Gravity Forms, sorted in the same order as in the All Forms page
442  *
443  * @see GFEntryList::all_entries_page() This method is based on the form-selecting code here
444  *
445  * @since 1.17.2
446  *
447  * @return int ID of the first form, sorted by title. `0` if no forms were found.
448  */
449  private function get_first_form_id() {
450 
451  $forms = RGFormsModel::get_forms( null, 'title' );
452 
453  if( ! isset( $forms[0] ) ) {
454  gravityview()->log->error( 'No forms were found' );
455  return 0;
456  }
457 
458  $first_form = $forms[0];
459 
460  $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
461 
462  return intval( $form_id );
463  }
464 
465 
466  function add_scripts_and_styles( $hook ) {
467 
468  if( ! class_exists( 'GFForms' ) ) {
469  gravityview()->log->error( 'GFForms does not exist.' );
470  return;
471  }
472 
473  // enqueue styles & scripts gf_entries
474  // But only if we're on the main Entries page, not on reports pages
475  if( GFForms::get_page() !== 'entry_list' ) {
476  return;
477  }
478 
479  $form_id = $this->get_form_id();
480 
481  // Things are broken; no forms were found
482  if( empty( $form_id ) ) {
483  return;
484  }
485 
486  wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
487 
488  $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
489 
490  wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
491 
492  wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
493  'nonce' => wp_create_nonce( 'gravityview_entry_approval'),
494  'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'),
495  'form_id' => $form_id,
496  'show_column' => (int)$this->show_approve_entry_column( $form_id ),
497  'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
498  'status_approved' => GravityView_Entry_Approval_Status::APPROVED,
499  'status_disapproved' => GravityView_Entry_Approval_Status::DISAPPROVED,
500  'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED,
501  'bulk_actions' => $this->get_bulk_actions( $form_id ),
502  'bulk_message' => $this->bulk_update_message,
503  'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
504  'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
505  'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
506  'column_title' => __( 'Show entry in directory view?', 'gravityview'),
507  'column_link' => esc_url( $this->get_sort_link() ),
508  ) );
509 
510  }
511 
512  /**
513  * Generate a link to sort by approval status
514  *
515  * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as
516  * numeric, but it does group the approved entries together.
517  *
518  * @since 2.0.14 Remove need for approval field for sorting by approval status
519  *
520  * @param int $form_id [NO LONGER USED]
521  *
522  * @return string Sorting link
523  */
524  private function get_sort_link( $form_id = 0 ) {
525 
526  $args = array(
527  'orderby' => 'is_approved',
528  'order' => ( 'desc' === \GV\Utils::_GET( 'order' ) ) ? 'asc' : 'desc',
529  );
530 
531  return add_query_arg( $args );
532  }
533 
534  /**
535  * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group
536  *
537  * @since 1.16.3
538  *
539  * @param int $form_id ID of the form currently being displayed
540  *
541  * @return array Array of actions to be added to the GravityView option group
542  */
543  private function get_bulk_actions( $form_id ) {
544 
545  $bulk_actions = array(
546  'GravityView' => array(
547  array(
548  'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'),
549  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
550  ),
551  array(
552  'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'),
553  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ),
554  ),
555  array(
556  'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'),
557  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
558  ),
559  ),
560  );
561 
562  /**
563  * @filter `gravityview/approve_entries/bulk_actions` Modify the GravityView "Bulk action" dropdown list. Return an empty array to hide.
564  * @see https://gist.github.com/zackkatz/82785402c996b51b4dc9 for an example of how to use this filter
565  * @since 1.16.3
566  * @param array $bulk_actions Associative array of actions to be added to "Bulk action" dropdown inside GravityView `<optgroup>`. Parent array key is the `<optgroup>` label, then each child array must have `label` (displayed text) and `value` (input value) keys
567  * @param int $form_id ID of the form currently being displayed
568  */
569  $bulk_actions = apply_filters( 'gravityview/approve_entries/bulk_actions', $bulk_actions, $form_id );
570 
571  // Sanitize the values, just to be sure.
572  foreach ( $bulk_actions as $key => $group ) {
573 
574  if( empty( $group ) ) {
575  continue;
576  }
577 
578  foreach ( $group as $i => $action ) {
579  $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
580  $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
581  }
582  }
583 
584  return $bulk_actions;
585  }
586 
587  /**
588  * Should the Approve/Reject Entry column be shown in the GF Entries page?
589  *
590  * @since 1.7.2
591  *
592  * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
593  *
594  * @return bool True: Show column; False: hide column
595  */
596  private function show_approve_entry_column( $form_id ) {
597 
598  $show_approve_column = GVCommon::has_cap( 'gravityview_moderate_entries' );
599 
600  /**
601  * @filter `gravityview/approve_entries/hide-if-no-connections` Return true to hide reject/approve if there are no connected Views
602  * @since 1.7.2
603  * @param boolean $hide_if_no_connections
604  */
605  $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
606 
607  if( $hide_if_no_connections ) {
608 
609  $connected_views = gravityview_get_connected_views( $form_id );
610 
611  if( empty( $connected_views ) ) {
612  $show_approve_column = false;
613  }
614  }
615 
616  /**
617  * @filter `gravityview/approve_entries/show-column` Override whether the column is shown
618  * @param boolean $show_approve_column Whether the column will be shown
619  * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
620  */
621  $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
622 
623  return $show_approve_column;
624  }
625 
626  function register_gform_noconflict_script( $scripts ) {
627  $scripts[] = 'gravityview_gf_entries_scripts';
628  return $scripts;
629  }
630 
631  function register_gform_noconflict_style( $styles ) {
632  $styles[] = 'gravityview_entries_list';
633  return $styles;
634  }
635 
636 }
637 
add_field_buttons( $field_groups)
Inject new add field buttons in the gravity form editor page.
static update_bulk( $entries=array(), $approved, $form_id)
Process a bulk of entries to update the approve field/property.
get_first_form_id()
Get the first form ID from Gravity Forms, sorted in the same order as in the All Forms page...
static update_approved( $entry_id=0, $approved=0, $form_id=0, $approvedcolumn=0)
update_approved function.
$forms
Definition: data-source.php:19
process_bulk_action()
Capture bulk actions - gf_entries table.
$entries
static get_approved_column( $form)
Calculate the approve field.input id.
gravityview()
Definition: _stubs.php:26
get( $key, $default=null)
Retrieve a setting.
static get_title_attr( $value_or_key)
Get the label for a specific approval value.
static get_search_criteria( $args, $form_id)
Parse search criteria for a entries search.
get_bulk_actions( $form_id)
Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" op...
filter_links_entry_list( $filter_links=array(), $form=array(), $include_counts=true)
Add filter links to the Entries page.
if(empty( $created_by)) $search_criteria
There was no logged in user who created this entry.
get_sort_link( $form_id=0)
Generate a link to sort by approval status.
const APPROVED
gravityview_get_connected_views( $form_id, $args=array())
Get the views for a particular form.
static update_approved( $entry_id=0, $approved=2, $form_id=0, $approvedcolumn=0)
update_approved function.
const GRAVITYVIEW_FILE
Full path to the GravityView file "GRAVITYVIEW_FILE" "./gravityview.php".
Definition: gravityview.php:31
$field_id
Definition: time.php:17
static get_entry_status( $entry, $value_or_label='label')
Get the approval status for an entry.
const DISAPPROVED
tooltips( $tooltips)
Add the GravityView Fields group tooltip.
static get_string( $value_or_key, $string_key='')
Get the label for a specific approval value.
get_form_id()
Get the form ID of the form currently being displayed.
if(empty( $created_by)) $form_id
const UNAPPROVED
static add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string)
Add a hidden input that is used in the Javascript to show approved/disapproved entries checkbox...
get_gv_bulk_action()
Get the Bulk Action submitted value if it is a GravityView Approve/Unapprove action.
gravityview_get_entry_ids( $form_id, $search_criteria=array())
Wrapper for the Gravity Forms GFFormsModel::search_lead_ids() method.
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
$entry
Definition: notes.php:27
set_defaults()
At edit form page, set the field Approve defaults.
show_approve_entry_column( $form_id)
Should the Approve/Reject Entry column be shown in the GF Entries page?
const meta_key
static _POST( $name, $default=null)
Grab a value from the _POST superglobal or default.
static get_label( $value_or_key)
Get the label for a specific approval value.
new GravityView_Admin_ApproveEntries