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