GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Static Public Member Functions | Data Fields | Private Member Functions | Static Private Member Functions
GravityView_Entry_Approval Class Reference

If this file is called directly, abort. More...

Public Member Functions

 __construct ()
 
 after_submission ($entry, $form)
 Update the is_approved meta whenever the entry is submitted (and it contains a User Opt-in field) More...
 
 after_update_entry_update_approved_meta ($form, $entry_id=NULL)
 Update the is_approved meta whenever the entry is updated. More...
 
 ajax_update_approved ()
 Approve/Disapprove entries using the × or ✓ icons in the GF Entries screen. More...
 

Static Public Member Functions

static get_entry_status ($entry, $value_or_label= 'label')
 Get the approval status for an entry. More...
 
static update_approved ($entry_id=0, $approved=2, $form_id=0, $approvedcolumn=0)
 update_approved function. More...
 
static update_bulk ($entries=array(), $approved, $form_id)
 Process a bulk of entries to update the approve field/property. More...
 

Data Fields

const meta_key = 'is_approved'
 

Private Member Functions

 add_hooks ()
 Add actions and filters related to entry approval. More...
 

Static Private Member Functions

static add_approval_status_updated_note ($entry_id, $approved=0)
 Add a note when an entry is approved. More...
 
static get_approved_column_input_label ($form, $approved_column)
 Get the value for the approved field checkbox. More...
 
static update_approved_meta ($entry_id, $status, $form_id=0)
 Update the is_approved entry meta value. More...
 

Detailed Description

If this file is called directly, abort.

Generate linked list output for a list of entries.

Since
1.18

Definition at line 23 of file class-gravityview-entry-approval.php.

Constructor & Destructor Documentation

__construct ( )

Definition at line 30 of file class-gravityview-entry-approval.php.

References add_hooks().

Member Function Documentation

static add_approval_status_updated_note (   $entry_id,
  $approved = 0 
)
staticprivate

Add a note when an entry is approved.

See also
GravityView_Entry_Approval::update_approved
Since
1.18
Parameters
int$entry_idGravity Forms entry ID
int$approvedApproval status
Returns
false|int|WP_Error Note ID if successful; WP_Error if error when adding note, FALSE if note not updated because of gravityview/approve_entries/add-note filter or GravityView_Entry_Notes class not existing
Runs Filter:
gravityview/approve_entries/add-note Add a note when the entry has been approved or disapproved?
Since
1.16.3
Parameters
bool$add_noteTrue: Yep, add that note! False: Do not, under any circumstances, add that note!

Definition at line 334 of file class-gravityview-entry-approval.php.

References $entry, $form_id, GravityView_Entry_Notes\add_note(), GravityView_Entry_Approval_Status\APPROVED, GravityView_Entry_Approval_Status\DISAPPROVED, GravityView_Entry_Approval_Status\is_valid(), GravityView_Entry_Approval_Status\maybe_convert_status(), and GravityView_Entry_Approval_Status\UNAPPROVED.

add_hooks ( )
private

Add actions and filters related to entry approval.

Returns
void

Definition at line 39 of file class-gravityview-entry-approval.php.

Referenced by __construct().

after_submission (   $entry,
  $form 
)

Update the is_approved meta whenever the entry is submitted (and it contains a User Opt-in field)

Since
1.16.6
Parameters
$entryarray Gravity Forms entry object
$formarray Gravity Forms form object

Definition at line 172 of file class-gravityview-entry-approval.php.

References $entry, $form, and after_update_entry_update_approved_meta().

after_update_entry_update_approved_meta (   $form,
  $entry_id = NULL 
)

Update the is_approved meta whenever the entry is updated.

Since
1.7.6.1 Was previously named update_approved_meta
Parameters
array$formGravity Forms form array
int$entry_idID of the Gravity Forms entry
Returns
void

If the form doesn't contain the approve field, don't assume anything.

Definition at line 185 of file class-gravityview-entry-approval.php.

References $entry, $form, $value, GravityView_Entry_Approval_Status\APPROVED, and GravityView_Entry_Approval_Status\DISAPPROVED.

Referenced by after_submission().

ajax_update_approved ( )

Approve/Disapprove entries using the × or ✓ icons in the GF Entries screen.

wp_send_json_error() wp_send_json_success()

Expects a $_POST request with the following $_POST keys and values:

array $_POST { int $form_id ID of the form connected to the entry being updated string|int $entry_slug The ID or slug of the entry being updated string $approved The value of the entry approval status {

See also
GravityView_Entry_Approval_Status::is_valid() } }
Returns
void Prints result using wp_send_json_success() and wp_send_json_error()

Definition at line 94 of file class-gravityview-entry-approval.php.

References $current_status, $form_id, GVCommon\get_entry_id(), GVCommon\has_cap(), and GravityView_Entry_Approval_Status\is_valid().

static get_approved_column_input_label (   $form,
  $approved_column 
)
staticprivate

Get the value for the approved field checkbox.

When approving a field via the entry meta, use the correct value for the new approved column input

Since
1.19
Parameters
array | int$formForm ID or form array
string$approved_columnApproved column field ID
Returns
string|null

Definition at line 432 of file class-gravityview-entry-approval.php.

References $field, $form, and gravityview_get_field().

static get_entry_status (   $entry,
  $value_or_label = 'label' 
)
static

Get the approval status for an entry.

Since
1.18 GVCommon::get_entry_id() Accepts entry slug or entry ID
Parameters
array | int | string$entryEntry array, entry slug, or entry ID
string$value_or_label"value" or "label" (default: "label")
Returns
bool|string Return the label or value of entry approval

Definition at line 63 of file class-gravityview-entry-approval.php.

References $entry, GVCommon\get_entry_id(), GravityView_Entry_Approval_Status\get_label(), and GravityView_Entry_Approval_Status\maybe_convert_status().

Referenced by GravityView_Admin_ApproveEntries\add_entry_approved_hidden_input(), and GravityView_Field_Is_Approved\custom_merge_tags().

static update_approved (   $entry_id = 0,
  $approved = 2,
  $form_id = 0,
  $approvedcolumn = 0 
)
static

update_approved function.

Since
1.18 Moved to GravityView_Entry_Approval class

public

Parameters
int$entry_id(default: 0)
int$approved(default: 2)
int$form_id(default: 0)
int$approvedcolumn(default: 0)
Returns
boolean True: It worked; False: it failed

Destroy the cache for this form

See also
class-cache.php
Since
1.5.1

Definition at line 269 of file class-gravityview-entry-approval.php.

References $entry, $form_id, GravityView_Entry_Approval_Status\is_valid(), and GravityView_Entry_Approval_Status\maybe_convert_status().

Referenced by GravityView_Admin_ApproveEntries\update_approved().

static update_approved_meta (   $entry_id,
  $status,
  $form_id = 0 
)
staticprivate

Update the is_approved entry meta value.

Since
1.7.6.1 after_update_entry_update_approved_meta was previously to be named update_approved_meta
1.17.1 Added $form_id parameter
Parameters
int$entry_idID of the Gravity Forms entry
string$statusString whether entry is approved or not. 0 for not approved, Approved for approved.
int$form_idID of the form of the entry being updated. Improves query performance.
Returns
void
Runs Actions:
gravityview/approve_entries/updated Triggered when an entry approval is updated
Since
1.7.6.1
Parameters
int$entry_idID of the Gravity Forms entry
string | int$statusString whether entry is approved or not. See GravityView_Entry_Approval_Status for valid statuses.
Runs Actions:
gravityview/approve_entries/{$action} Triggered when an entry approval is reset. $action can be 'approved', 'unapproved', or 'disapproved'
Since
1.7.6.1
1.18 Added "unapproved"
Parameters
int$entry_idID of the Gravity Forms entry

Definition at line 462 of file class-gravityview-entry-approval.php.

References $field, $form, $form_id, GVCommon\get_form(), GravityView_Entry_Approval_Status\get_key(), GravityView_Entry_Approval_Status\is_unapproved(), GravityView_Entry_Approval_Status\is_valid(), and GravityView_Entry_Approval_Status\maybe_convert_status().

static update_bulk (   $entries = array(),
  $approved,
  $form_id 
)
static

Process a bulk of entries to update the approve field/property.

Since
1.18 Moved to GravityView_Entry_Approval
1.18 Made public

public

Parameters
array | boolean$entriesIf array, array of entry IDs that are to be updated. If true: update all entries.
int$approvedApproved status. If 0: unapproved, if not empty, Approved
int$form_idThe Gravity Forms Form ID
Returns
boolean|null True: successfully updated all entries. False: there was an error updating at least one entry. NULL: an error occurred (see log)

Definition at line 222 of file class-gravityview-entry-approval.php.

References $entries, $form_id, GVCommon\has_cap(), and GravityView_Entry_Approval_Status\is_valid().

Referenced by GravityView_Admin_ApproveEntries\process_bulk_action().

Field Documentation

const meta_key = 'is_approved'

The documentation for this class was generated from the following file: