GravityView  2.9.2
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 GravityView <hello@gravityview.co>
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  * @param mixed $field_groups
164  * @return array Array of fields
165  */
166  function add_field_buttons( $field_groups ) {
167 
168  $gravityview_fields = array(
169  'name' => 'gravityview_fields',
170  'label' => 'GravityView',
171  'fields' => array(
172  array(
173  'class' => 'button',
174  'value' => __( 'Approve/Reject', 'gravityview' ),
175  'onclick' => "StartAddField('gravityviewapproved_admin');",
176  'data-type' => 'gravityviewapproved_admin'
177  ),
178  array(
179  'class' => 'button',
180  'value' => __( 'User Opt-In', 'gravityview' ),
181  'onclick' => "StartAddField('gravityviewapproved');",
182  'data-type' => 'gravityviewapproved'
183  ),
184  )
185  );
186 
187  array_push( $field_groups, $gravityview_fields );
188 
189  return $field_groups;
190  }
191 
192 
193 
194  /**
195  * At edit form page, set the field Approve defaults
196  *
197  * @todo Convert to a partial include file
198  * @return void
199  */
200  function set_defaults() {
201  ?>
202  case 'gravityviewapproved_admin':
203  field.label = "<?php echo esc_js( __( 'Approved? (Admin-only)', 'gravityview' ) ); ?>";
204 
205  field.adminLabel = "<?php echo esc_js( __( 'Approved?', 'gravityview' ) ); ?>";
206  field.adminOnly = true;
207 
208  field.choices = null;
209  field.inputs = null;
210 
211  if( !field.choices ) {
212  field.choices = new Array( new Choice("<?php echo esc_js( GravityView_Entry_Approval_Status::get_label( GravityView_Entry_Approval_Status::APPROVED ) ); ?>") );
213  }
214 
215  field.inputs = new Array();
216  for( var i=1; i<=field.choices.length; i++ ) {
217  field.inputs.push(new Input(field.id + (i/10), field.choices[i-1].text));
218  }
219 
220  field.type = 'checkbox';
221  field.gravityview_approved = 1;
222 
223  break;
224  case 'gravityviewapproved':
225  field.label = "<?php echo esc_js( __( 'Show Entry on Website', 'gravityview' ) ); ?>";
226 
227  field.adminLabel = "<?php echo esc_js( __( 'Opt-In', 'gravityview' ) ); ?>";
228  field.adminOnly = false;
229 
230  field.choices = null;
231  field.inputs = null;
232 
233  if( !field.choices ) {
234  field.choices = new Array(
235  new Choice("<?php echo esc_js( __( 'Yes, display my entry on the website', 'gravityview' ) ); ?>")
236  );
237  }
238 
239  field.inputs = new Array();
240  for( var i=1; i<=field.choices.length; i++ ) {
241  field.inputs.push(new Input(field.id + (i/10), field.choices[i-1].text));
242  }
243 
244  field.type = 'checkbox';
245  field.gravityview_approved = 1;
246 
247  break;
248  <?php
249  }
250 
251  /**
252  * Get the Bulk Action submitted value if it is a GravityView Approve/Unapprove action
253  *
254  * @since 1.17.1
255  *
256  * @return string|false If the bulk action was GravityView Approve/Unapprove, return the full string (gvapprove-16, gvunapprove-16). Otherwise, return false.
257  */
258  private function get_gv_bulk_action() {
259 
260  $gv_bulk_action = false;
261 
262  if( version_compare( GFForms::$version, '2.0', '>=' ) ) {
263  $bulk_action = ( '-1' !== \GV\Utils::_POST( 'action' ) ) ? \GV\Utils::_POST( 'action' ) : \GV\Utils::_POST( 'action2' );
264  } else {
265  // GF 1.9.x - Bulk action 2 is the bottom bulk action select form.
266  $bulk_action = \GV\Utils::_POST( 'bulk_action' ) ? \GV\Utils::_POST( 'bulk_action' ) : \GV\Utils::_POST( 'bulk_action2' );
267  }
268 
269  // Check the $bulk_action value against GV actions, see if they're the same. I hate strpos().
270  if( ! empty( $bulk_action ) && preg_match( '/^('. implode( '|', $this->bulk_action_prefixes ) .')/ism', $bulk_action ) ) {
271  $gv_bulk_action = $bulk_action;
272  }
273 
274  return $gv_bulk_action;
275  }
276 
277  /**
278  * Capture bulk actions - gf_entries table
279  *
280  * @uses GravityView_frontend::get_search_criteria() Convert the $_POST search request into a properly formatted request.
281  * @return void|boolean
282  */
283  public function process_bulk_action() {
284 
285  if ( ! is_admin() || ! class_exists( 'GFForms' ) || empty( $_POST ) ) {
286  return false;
287  }
288 
289  // 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.
290  $bulk_action = $this->get_gv_bulk_action();
291 
292  // gforms_entry_list is the nonce that confirms we're on the right page
293  // gforms_update_note is sent when bulk editing entry notes. We don't want to process then.
294  if ( $bulk_action && \GV\Utils::_POST( 'gforms_entry_list' ) && empty( $_POST['gforms_update_note'] ) ) {
295 
296  check_admin_referer( 'gforms_entry_list', 'gforms_entry_list' );
297 
298  /**
299  * The extra '-' is to make sure that there are at *least* two items in array.
300  * @see https://github.com/katzwebservices/GravityView/issues/370
301  */
302  $bulk_action .= '-';
303 
304  list( $approved_status, $form_id ) = explode( '-', $bulk_action );
305 
306  if ( empty( $form_id ) ) {
307  gravityview()->log->error( 'Form ID is empty from parsing bulk action.', array( 'data' => $bulk_action ) );
308  return false;
309  }
310 
311  // All entries are set to be updated, not just the visible ones
312  if ( ! empty( $_POST['all_entries'] ) ) {
313 
314  // Convert the current entry search into GF-formatted search criteria
315  $search = array(
316  'search_field' => isset( $_POST['f'] ) ? $_POST['f'][0] : 0,
317  'search_value' => isset( $_POST['v'][0] ) ? $_POST['v'][0] : '',
318  'search_operator' => isset( $_POST['o'][0] ) ? $_POST['o'][0] : 'contains',
319  );
320 
321  $search_criteria = GravityView_frontend::get_search_criteria( $search, $form_id );
322 
323  // Get all the entry IDs for the form
324  $entries = gravityview_get_entry_ids( $form_id, $search_criteria );
325 
326  } else {
327 
328  // Changed from 'lead' to 'entry' in 2.0
329  $entries = isset( $_POST['lead'] ) ? $_POST['lead'] : $_POST['entry'];
330 
331  }
332 
333  if ( empty( $entries ) ) {
334  gravityview()->log->error( 'Entries are empty' );
335  return false;
336  }
337 
338  $entry_count = count( $entries ) > 1 ? sprintf( __( '%d entries', 'gravityview' ), count( $entries ) ) : __( '1 entry', 'gravityview' );
339 
340  switch ( $approved_status ) {
341  case $this->bulk_action_prefixes['approve']:
343  $this->bulk_update_message = sprintf( __( '%s approved.', 'gravityview' ), $entry_count );
344  break;
345  case $this->bulk_action_prefixes['unapprove']:
347  $this->bulk_update_message = sprintf( __( '%s unapproved.', 'gravityview' ), $entry_count );
348  break;
349  case $this->bulk_action_prefixes['disapprove']:
351  $this->bulk_update_message = sprintf( __( '%s disapproved.', 'gravityview' ), $entry_count );
352  break;
353  }
354  }
355  }
356 
357 
358  /**
359  * update_approved function.
360  *
361  * @since 1.18 Moved to GravityView_Entry_Approval::update_approved
362  * @see GravityView_Entry_Approval::update_approved
363  *
364  * @param int $entry_id (default: 0)
365  * @param int $approved (default: 0)
366  * @param int $form_id (default: 0)
367  * @param int $approvedcolumn (default: 0)
368  *
369  * @return boolean True: It worked; False: it failed
370  */
371  public static function update_approved( $entry_id = 0, $approved = 0, $form_id = 0, $approvedcolumn = 0) {
372  return GravityView_Entry_Approval::update_approved( $entry_id, $approved, $form_id, $approvedcolumn );
373  }
374 
375  /**
376  * Calculate the approve field.input id
377  *
378  * @since 1.18 Moved to GravityView_Entry_Approval::get_approved_column
379  * @see GravityView_Entry_Approval::get_approved_column
380  *
381  * @param mixed $form GF Form or Form ID
382  * @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.
383  */
384  static public function get_approved_column( $form ) {
385  return GravityView_Entry_Approval::get_approved_column( $form );
386  }
387 
388  /**
389  * Add a hidden input that is used in the Javascript to show approved/disapproved entries checkbox
390  *
391  * See the /assets/js/admin-entries-list.js setInitialApprovedEntries method
392  *
393  * @param $form_id
394  * @param $field_id
395  * @param $value
396  * @param $entry
397  * @param $query_string
398  *
399  * @return void
400  */
401  static public function add_entry_approved_hidden_input( $form_id, $field_id, $value, $entry, $query_string ) {
402 
403  if( ! GVCommon::has_cap( 'gravityview_moderate_entries', $entry['id'] ) ) {
404  return;
405  }
406 
407  if( empty( $entry['id'] ) ) {
408  return;
409  }
410 
411  $status_value = GravityView_Entry_Approval::get_entry_status( $entry, 'value' );
412 
413  if( $status_value ) {
414  echo '<input type="hidden" class="entry_approval" id="entry_approved_'. $entry['id'] .'" value="' . esc_attr( $status_value ) . '" />';
415  }
416  }
417 
418  /**
419  * Get the form ID of the form currently being displayed
420  *
421  * @since 1.17.1
422  *
423  * @return int ID of the current form being displayed. `0` is returned if no forms are found.
424  */
425  private function get_form_id() {
426 
427  $form_id = GFForms::get('id');
428 
429  // If there are no forms identified, use the first form. That's how GF does it.
430  if( empty( $form_id ) && class_exists('RGFormsModel') ) {
431  $form_id = $this->get_first_form_id();
432  }
433 
434  return absint( $form_id );
435  }
436 
437  /**
438  * Get the first form ID from Gravity Forms, sorted in the same order as in the All Forms page
439  *
440  * @see GFEntryList::all_entries_page() This method is based on the form-selecting code here
441  *
442  * @since 1.17.2
443  *
444  * @return int ID of the first form, sorted by title. `0` if no forms were found.
445  */
446  private function get_first_form_id() {
447 
448  $forms = RGFormsModel::get_forms( null, 'title' );
449 
450  if( ! isset( $forms[0] ) ) {
451  gravityview()->log->error( 'No forms were found' );
452  return 0;
453  }
454 
455  $first_form = $forms[0];
456 
457  $form_id = is_object( $forms[0] ) ? $first_form->id : $first_form['id'];
458 
459  return intval( $form_id );
460  }
461 
462 
463  function add_scripts_and_styles( $hook ) {
464 
465  if( ! class_exists( 'GFForms' ) ) {
466  gravityview()->log->error( 'GFForms does not exist.' );
467  return;
468  }
469 
470  // enqueue styles & scripts gf_entries
471  // But only if we're on the main Entries page, not on reports pages
472  if( GFForms::get_page() !== 'entry_list' ) {
473  return;
474  }
475 
476  $form_id = $this->get_form_id();
477 
478  // Things are broken; no forms were found
479  if( empty( $form_id ) ) {
480  return;
481  }
482 
483  wp_enqueue_style( 'gravityview_entries_list', plugins_url('assets/css/admin-entries-list.css', GRAVITYVIEW_FILE), array(), GravityView_Plugin::version );
484 
485  $script_debug = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min';
486 
487  wp_enqueue_script( 'gravityview_gf_entries_scripts', plugins_url('assets/js/admin-entries-list'.$script_debug.'.js', GRAVITYVIEW_FILE), array( 'jquery' ), GravityView_Plugin::version );
488 
489  wp_enqueue_script( 'gravityview_entries_list-popper', plugins_url( 'assets/lib/tippy/popper.min.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
490  wp_enqueue_script( 'gravityview_entries_list-tippy', plugins_url( 'assets/lib/tippy/tippy.min.js', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
491  wp_enqueue_style( 'gravityview_entries_list-tippy', plugins_url( 'assets/lib/tippy/tippy.css', GRAVITYVIEW_FILE ), array(), GravityView_Plugin::version );
492 
493  wp_localize_script( 'gravityview_gf_entries_scripts', 'gvGlobals', array(
494  'nonce' => wp_create_nonce( 'gravityview_entry_approval'),
495  'admin_nonce' => wp_create_nonce( 'gravityview_admin_entry_approval'),
496  'form_id' => $form_id,
497  'show_column' => (int)$this->show_approve_entry_column( $form_id ),
498  'add_bulk_action' => (int)GVCommon::has_cap( 'gravityview_moderate_entries' ),
499  'status_approved' => GravityView_Entry_Approval_Status::APPROVED,
500  'status_disapproved' => GravityView_Entry_Approval_Status::DISAPPROVED,
501  'status_unapproved' => GravityView_Entry_Approval_Status::UNAPPROVED,
502  'bulk_actions' => $this->get_bulk_actions( $form_id ),
503  'bulk_message' => $this->bulk_update_message,
504  'unapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('unapproved'),
505  'approve_title' => GravityView_Entry_Approval_Status::get_title_attr('disapproved'),
506  'disapprove_title' => GravityView_Entry_Approval_Status::get_title_attr('approved'),
507  'column_title' => __( 'Show entry in directory view?', 'gravityview'),
508  'column_link' => esc_url( $this->get_sort_link() ),
509  'status_popover_template' => GravityView_Entry_Approval::get_popover_template(),
510  'status_popover_placement' => GravityView_Entry_Approval::get_popover_placement(),
511  ) );
512 
513  }
514 
515  /**
516  * Generate a link to sort by approval status
517  *
518  * Note: Sorting by approval will never be great because it's not possible currently to declare the sorting as
519  * numeric, but it does group the approved entries together.
520  *
521  * @since 2.0.14 Remove need for approval field for sorting by approval status
522  *
523  * @param int $form_id [NO LONGER USED]
524  *
525  * @return string Sorting link
526  */
527  private function get_sort_link( $form_id = 0 ) {
528 
529  $args = array(
530  'orderby' => 'is_approved',
531  'order' => ( 'desc' === \GV\Utils::_GET( 'order' ) ) ? 'asc' : 'desc',
532  );
533 
534  return add_query_arg( $args );
535  }
536 
537  /**
538  * Get an array of options to be added to the Gravity Forms "Bulk action" dropdown in a "GravityView" option group
539  *
540  * @since 1.16.3
541  *
542  * @param int $form_id ID of the form currently being displayed
543  *
544  * @return array Array of actions to be added to the GravityView option group
545  */
546  private function get_bulk_actions( $form_id ) {
547 
548  $bulk_actions = array(
549  'GravityView' => array(
550  array(
551  'label' => GravityView_Entry_Approval_Status::get_string('approved', 'action'),
552  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['approve'], $form_id ),
553  ),
554  array(
555  'label' => GravityView_Entry_Approval_Status::get_string('disapproved', 'action'),
556  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['disapprove'], $form_id ),
557  ),
558  array(
559  'label' => GravityView_Entry_Approval_Status::get_string('unapproved', 'action'),
560  'value' => sprintf( '%s-%d', $this->bulk_action_prefixes['unapprove'], $form_id ),
561  ),
562  ),
563  );
564 
565  /**
566  * @filter `gravityview/approve_entries/bulk_actions` Modify the GravityView "Bulk action" dropdown list. Return an empty array to hide.
567  * @see https://gist.github.com/zackkatz/82785402c996b51b4dc9 for an example of how to use this filter
568  * @since 1.16.3
569  * @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
570  * @param int $form_id ID of the form currently being displayed
571  */
572  $bulk_actions = apply_filters( 'gravityview/approve_entries/bulk_actions', $bulk_actions, $form_id );
573 
574  // Sanitize the values, just to be sure.
575  foreach ( $bulk_actions as $key => $group ) {
576 
577  if( empty( $group ) ) {
578  continue;
579  }
580 
581  foreach ( $group as $i => $action ) {
582  $bulk_actions[ $key ][ $i ]['label'] = esc_html( $bulk_actions[ $key ][ $i ]['label'] );
583  $bulk_actions[ $key ][ $i ]['value'] = esc_attr( $bulk_actions[ $key ][ $i ]['value'] );
584  }
585  }
586 
587  return $bulk_actions;
588  }
589 
590  /**
591  * Should the Approve/Reject Entry column be shown in the GF Entries page?
592  *
593  * @since 1.7.2
594  *
595  * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
596  *
597  * @return bool True: Show column; False: hide column
598  */
599  private function show_approve_entry_column( $form_id ) {
600 
601  $show_approve_column = GVCommon::has_cap( 'gravityview_moderate_entries' );
602 
603  /**
604  * @filter `gravityview/approve_entries/hide-if-no-connections` Return true to hide reject/approve if there are no connected Views
605  * @since 1.7.2
606  * @param boolean $hide_if_no_connections
607  */
608  $hide_if_no_connections = apply_filters('gravityview/approve_entries/hide-if-no-connections', false );
609 
610  if( $hide_if_no_connections ) {
611 
612  $connected_views = gravityview_get_connected_views( $form_id );
613 
614  if( empty( $connected_views ) ) {
615  $show_approve_column = false;
616  }
617  }
618 
619  /**
620  * @filter `gravityview/approve_entries/show-column` Override whether the column is shown
621  * @param boolean $show_approve_column Whether the column will be shown
622  * @param int $form_id The ID of the Gravity Forms form for which entries are being shown
623  */
624  $show_approve_column = apply_filters('gravityview/approve_entries/show-column', $show_approve_column, $form_id );
625 
626  return $show_approve_column;
627  }
628 
629  function register_gform_noconflict_script( $scripts ) {
630  $scripts[] = 'gravityview_gf_entries_scripts';
631  $scripts[] = 'gravityview_entries_list-popper';
632  $scripts[] = 'gravityview_entries_list-tippy';
633  return $scripts;
634  }
635 
636  function register_gform_noconflict_style( $styles ) {
637  $styles[] = 'gravityview_entries_list';
638  $styles[] = 'gravityview_entries_list-tippy';
639  return $styles;
640  }
641 
642 }
643 
add_field_buttons( $field_groups)
Inject new add field buttons in the gravity form editor page.
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.
static get_popover_placement()
Where should the popover be placed?
$entries
static get_approved_column( $form)
Calculate the approve field.input id.
static update_bulk( $entries=array(), $approved=0, $form_id=0)
Process a bulk of entries to update the approve field/property.
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.
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 get_popover_template()
Get HTML template for a popover used to display approval statuses.
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