Methods summary
public static
mixed
|
#
get_form( integer $form_id )
Returns the form object for a given Form ID.
Returns the form object for a given Form ID.
Parameters
- $form_id
- The ID of the Form.
Returns
mixed The form meta array or false.
Since
1.8
Uses
GFFormsModel::get_form_meta()
GFFormsModel::get_form()
Used by
|
public static
array
|
#
get_forms( boolean $active = true, boolean $trash = false )
Returns all the form objects.
Returns all the form objects.
Parameters
- $active
- True if active forms are returned. False to get inactive forms. Defaults to
true.
- $trash
- True if trashed forms are returned. False to exclude trash. Defaults to false.
Returns
array The array of Form Objects.
Since
1.8.11.5
Uses
|
public static
|
#
delete_forms( array $form_ids )
Deletes the forms with the given Form IDs.
Deletes the forms with the given Form IDs.
Parameters
- $form_ids
- An array of form IDs to delete.
Since
1.8
Uses
GFFormsModel::delete_forms()
Used by
|
public static
mixed
|
#
delete_form( integer $form_id )
Deletes the form with the given Form ID.
Deletes the form with the given Form ID.
Parameters
- $form_id
- The ID of the Form to delete.
Returns
mixed True for success, or a WP_Error instance.
Since
1.8
Uses
|
public static
mixed
|
#
duplicate_form( integer $form_id )
Duplicates the form with the given Form ID.
Duplicates the form with the given Form ID.
Parameters
- $form_id
- The ID of the Form to delete.
Returns
mixed True for success, or a WP_Error instance
Since
2.2
Uses
GFFormsModel::duplicate_form()
|
public static
mixed
|
#
update_forms( array $forms )
Updates the forms with an array of form objects.
Updates the forms with an array of form objects.
Parameters
- $forms
- Array of form objects.
Returns
mixed True for success, or a WP_Error instance.
Since
1.8
Uses
|
public static
boolean|WP_Error
|
#
update_form( array $form, integer $form_id = null )
Updates the form with a given form object.
Updates the form with a given form object.
Parameters
- $form
- The Form object
- $form_id
- Optional. If specified, then the ID in the Form Object will be ignored.
Returns
boolean|WP_Error True for success, or a WP_Error instance.
Since
1.8
Uses
\GFFormsModel::get_meta_table_name()
\GFFormsModel::update_form_meta()
Used by
|
public static
mixed
|
#
update_forms_property( array $form_ids, string $property_key, mixed $value )
Updates a form property - a column in the main forms table. e.g. is_trash,
is_active, title
Updates a form property - a column in the main forms table. e.g. is_trash,
is_active, title
Parameters
- $form_ids
- The IDs of the forms to update.
- $property_key
- The name of the column in the database e.g. is_trash, is_active, title.
- $value
- The new value.
Returns
mixed Either a WP_Error instance or the result of the query
Since
1.8.3.15
Uses
GFFormsModel::get_form_table_name()
GFFormsModel::get_form_db_columns()
Used by
|
public static
mixed
|
#
update_form_property( array|integer $form_id, string $property_key, string $value )
Updates the property of one form - columns in the main forms table. e.g.
is_trash, is_active, title.
Updates the property of one form - columns in the main forms table. e.g.
is_trash, is_active, title.
Parameters
- $form_id
- The ID of the forms to update.
- $property_key
- The name of the column in the database e.g. is_trash, is_active, title.
- $value
- The new value.
Returns
mixed Either a WP_Error instance or the result of the query
Since
1.8.3.15
Uses
|
public static
array|WP_Error
|
#
add_forms( array $forms )
Adds multiple form objects.
Adds multiple form objects.
Parameters
Returns
array|WP_Error Either an array of new form IDs or a WP_Error instance.
Since
1.8
Uses
|
public static
integer|WP_Error
|
#
add_form( array $form_meta )
Adds a new form using the given Form object. Warning, little checking is done
to make sure it's a valid Form object.
Adds a new form using the given Form object. Warning, little checking is done
to make sure it's a valid Form object.
Parameters
- $form_meta
- The Form object.
Returns
integer|WP_Error Either the new Form ID or a WP_Error instance.
Since
1.8
Uses
GFFormsModel::is_unique_title()
GFFormsModel::insert_form()
GFAPI::set_property_as_key()
GFFormsModel::update_form_meta()
Used by
|
public static
array|WP_Error
|
#
get_entries( integer|array $form_ids, array $search_criteria = array(), array $sorting = null, array $paging = null, integer & $total_count = null )
Returns an array of Entry objects for the given search criteria. The search
criteria array is constructed as follows:
Returns an array of Entry objects for the given search criteria. The search
criteria array is constructed as follows:
Filter by status $search_criteria['status'] = 'active';
Filter by date range $search_criteria['start_date'] = $start_date; // Using the
time zone in the general settings. $search_criteria['end_date'] = $end_date; //
Using the time zone in the general settings.
Filter by any column in the main table $search_criteria['field_filters'][] =
array("key" => 'currency', value => 'USD');
$search_criteria['field_filters'][] = array("key" => 'is_read', value =>
true);
Filter by Field Values $search_criteria['field_filters'][] = array('key' =>
'1', 'value' => 'gquiz159982170');
Filter Operators Supported operators for scalar values: is/=, isnot/<>,
contains $search_criteria['field_filters'][] = array('key' => '1', 'operator'
=> 'contains', value' => 'Steve'); Supported operators for array values:
in/=, not in/<>/!= $search_criteria['field_filters'][] = array('key' =>
'1', 'operator' => 'not in', value' => array( 'Alex', 'David', 'Dana'
);
Filter by a checkbox value - input ID search keys
$search_criteria['field_filters'][] = array('key' => '2.2', 'value' =>
'gquiz246fec995'); NOTES: - Using input IDs as search keys will work for
checkboxes but it won't work if the checkboxes have been re-ordered since the
first submission. - the 'not in' operator is not currently supported for
checkbox values.
Filter by a checkbox value - field ID keys Using the field ID as the search key
is recommended for checkboxes. $search_criteria['field_filters'][] = array('key'
=> '2', 'value' => 'gquiz246fec995'); $search_criteria['field_filters'][]
= array('key' => '2', 'operator' => 'in', 'value' => array( 'First
Choice', 'Third Choice' ); NOTE: Neither 'not in' nor '<>' operators are
not currently supported for checkboxes using field IDs as search keys.
Filter by a global search of values of any form field
$search_criteria['field_filters'][] = array('value' => $search_value); OR
$search_criteria['field_filters'][] = array('key' => 0, 'value' =>
$search_value);
Filter entries by Entry meta (added using the gform_entry_meta hook)
$search_criteria['field_filters'][] = array('key' => 'gquiz_score', 'value'
=> '1'); $search_criteria['field_filters'][] = array('key' =>
'gquiz_is_pass', 'value' => '1');
Filter by ALL / ANY of the field filters
$search_criteria['field_filters']['mode'] = 'all'; // default
$search_criteria['field_filters']['mode'] = 'any';
Sorting: column, field or entry meta $sorting = array('key' => $sort_field,
'direction' => 'ASC' );
Paging $paging = array('offset' => 0, 'page_size' => 20 );
Parameters
- $form_ids
- The ID of the form or an array IDs of the Forms. Zero for all forms.
- $search_criteria
- Optional. An array containing the search criteria. Defaults to empty array.
- $sorting
- Optional. An array containing the sorting criteria. Defaults to null.
- $paging
- Optional. An array containing the paging criteria. Defaults to null.
- $total_count
- Optional. An output parameter containing the total number of entries. Pass a
non-null value to get the total count. Defaults to null.
Returns
array|WP_Error Either an array of the Entry objects or a WP_Error instance.
Since
1.8
Used by
|
public static
array
|
#
get_entry_ids( integer|array $form_id, array $search_criteria = array(), array $sorting = null, array $paging = null, null|integer & $total_count = null )
Returns an array of Entry IDs for the given search criteria.
Returns an array of Entry IDs for the given search criteria.
Parameters
- $form_id
- The ID of the form or an array IDs of the Forms. Zero for all forms.
- $search_criteria
- Optional. An array containing the search criteria. Defaults to empty array.
- $sorting
- Optional. An array containing the sorting criteria. Defaults to null.
- $paging
- Optional. An array containing the paging criteria. Defaults to null.
- $total_count
- Optional. An output parameter containing the total number of entries. Pass a
non-null value to get the total count. Defaults to null.
Returns
array An array of the Entry IDs.
Since
2.3 Added $sorting and $paging parameters.
Unknown
|
public static
integer
|
#
count_entries( integer|array $form_ids, array $search_criteria = array() )
Returns the total number of entries for the given search criteria. See
get_entries() for examples of the search criteria.
Returns the total number of entries for the given search criteria. See
get_entries() for examples of the search criteria.
Parameters
- $form_ids
- The ID of the Form or an array of Form IDs.
- $search_criteria
- Optional. An array containing the search criteria. Defaults to empty array.
Returns
integer The total count.
Since
1.8
Uses
GFFormsModel::count_search_leads()
|
public static
array|WP_Error
|
#
get_entry( integer $entry_id )
Returns the Entry object for a given Entry ID.
Returns the Entry object for a given Entry ID.
Parameters
- $entry_id
- The ID of the Entry.
Returns
array|WP_Error The Entry object or a WP_Error instance.
Since
1.8
Uses
Used by
|
public static
array|WP_Error
|
#
add_entries( array $entries, integer $form_id = null )
Adds multiple Entry objects.
Adds multiple Entry objects.
Parameters
- $entries
- The Entry objects
- $form_id
- Optional. If specified, the form_id in the Entry objects will be ignored.
Defaults to null.
Returns
array|WP_Error Either an array of new Entry IDs or a WP_Error instance
Since
1.8
Uses
|
public static
boolean|WP_Error
|
#
update_entries( array $entries )
Updates multiple Entry objects.
Updates multiple Entry objects.
Parameters
- $entries
- The Entry objects
Returns
boolean|WP_Error Either true for success, or a WP_Error instance
Since
1.8
Uses
|
public static
true|WP_Error
|
#
update_entry( array $entry, integer $entry_id = null )
Updates an entire single Entry object.
Updates an entire single Entry object.
If the date_created value is not set then the current time UTC will be used.
The date_created value, if set, is expected to be in 'Y-m-d H:i:s' format
(UTC).
Parameters
- $entry
- The Entry Object.
- $entry_id
- Optional. If specified, the ID in the Entry Object will be ignored. Defaults to
null.
Returns
true|WP_Error Either True or a WP_Error instance
Since
1.8
Uses
GFAPI::get_entry()
GFAPI::form_id_exists()
\GFFormsModel::get_ip
\GFFormsModel::get_current_page_url
\GFCommon::get_currency
\GFFormsModel::get_lead_table_name
\GFFormsModel::get_lead_details_table_name
\GFFormsModel::get_form_meta
\GFFormsModel::get_input_type
\GF_Field::get_entry_inputs
\GFFormsModel::get_lead_detail_id
\GFFormsModel::update_lead_field_value
\GFFormsModel::get_entry_meta
\GFFormsModel::get_field
Used by
|
public static
integer|WP_Error
|
#
add_entry( array $entry )
Adds a single Entry object.
Adds a single Entry object.
Intended to be used for importing an entry object. The usual hooks that are
triggered while saving entries are not fired here. Checks that the form id,
field ids and entry meta exist and ignores legacy values (i.e. values for fields
that no longer exist).
Parameters
Returns
integer|WP_Error Either the new Entry ID or a WP_Error instance.
Since
1.8
Uses
GFAPI::form_id_exists()
GFFormsModel::get_ip()
GFFormsModel::get_current_page_url()
GFCommon::get_currency()
GFFormsModel::get_lead_table_name()
GF_Field::get_entry_inputs()
GFFormsModel::update_lead_field_value()
GFFormsModel::get_entry_meta()
GFAPI::get_entry()
Used by
|
public static
boolean|WP_Error
|
#
delete_entry( integer $entry_id )
Deletes a single Entry.
Parameters
- $entry_id
- The ID of the Entry object.
Returns
boolean|WP_Error Either true for success or a WP_Error instance.
Since
1.8
Uses
GFFormsModel::get_lead()
GFFormsModel::delete_lead()
|
public static
boolean
|
#
update_entry_property( integer $entry_id, string $property, mixed $value )
Updates a single property of an entry.
Updates a single property of an entry.
Parameters
- $entry_id
- The ID of the Entry object.
- $property
- The property of the Entry object to be updated.
- $value
- The value to which the property should be set.
Returns
boolean Whether the entry property was updated successfully.
Since
1.8.3.1
Uses
GFFormsModel::update_lead_property()
|
public static
boolean|array
|
#
update_entry_field( integer $entry_id, string $input_id, mixed $value, string $item_index = '' )
Updates a single field of an entry.
Updates a single field of an entry.
Parameters
- $entry_id
- The ID of the Entry object.
- $input_id
- The id of the input to be updated. For single input fields such as text,
paragraph, website, drop down etc... this will be the same as the field ID. For
multi input fields such as name, address, checkboxes, etc... the input id will
be in the format {FIELD_ID}.{INPUT NUMBER}. ( i.e. "1.3" ). The $input_id can be
obtained by inspecting the key for the specified field in the $entry object.
- $value
- The value to which the field should be set.
- $item_index
- The item index if the field is inside a Repeater.
Returns
boolean|array Whether the entry property was updated successfully. If there's an error getting
the entry, the entry object.
Since
1.9
|
public static
array|WP_Error
|
#
submit_form( integer $form_id, array $input_values, array $field_values = array(), integer $target_page = 0, integer $source_page = 1 )
Submits a form. Use this function to send input values through the complete
form submission process. Supports field validation, notifications,
confirmations, multiple-pages and save & continue.
Submits a form. Use this function to send input values through the complete
form submission process. Supports field validation, notifications,
confirmations, multiple-pages and save & continue.
Example usage: $input_values['input1'] = 'Single line text';
$input_values['input2_3'] = 'First name';
$input_values['input2_6'] = 'Last name';
$input_values['input5'] = 'A paragraph of text.';
//$input_values['gform_save'] = true; // support for save and continue
$result = GFAPI::submit_form( 52, $input_values );
Example output for a successful submission: 'is_valid' => boolean true
'page_number' => int 0 'source_page_number' => int 1
'confirmation_message' => string 'confirmation message [snip]'
Example output for failed validation: 'is_valid' => boolean false
'validation_messages' => array (size=1) 2 => string 'This field is
required. Please enter the first and last name.' 'page_number' => int 1
'source_page_number' => int 1 'confirmation_message' => string ''
Example output for save and continue: 'is_valid' => boolean true
'page_number' => int 1 'source_page_number' => int 1
'confirmation_message' => string 'Please use the following link to return to
your form from any computer. [snip]' 'resume_token' => string
'045f941cc4c04d479556bab1db6d3495'
Parameters
- $form_id
- The Form ID
- $input_values
- An array of values. Not $_POST, that will be automatically merged with the
$input_values.
- $field_values
- Optional.
- $target_page
- Optional.
- $source_page
- Optional.
Returns
array|WP_Error An array containing the result of the submission.
Since
Unknown
Uses
GFAPI::get_form()
GFCommon::get_base_path()
GFFormDisplay::process_form()
GFFormDisplay::replace_save_variables()
|
public static
array|WP_Error
|
#
get_feeds( mixed $feed_ids = null, integer $form_id = null, string $addon_slug = null, boolean $is_active = true )
Returns all the feeds for the given criteria.
Returns all the feeds for the given criteria.
Parameters
- $feed_ids
- The ID of the Feed or an array of Feed IDs.
- $form_id
- The ID of the Form to which the Feeds belong.
- $addon_slug
- The slug of the add-on to which the Feeds belong.
- $is_active
- If the feed is active.
Returns
array|WP_Error Either an array of Feed objects or a WP_Error instance.
Since
1.8
|
public static
boolean|WP_Error
|
#
delete_feed( integer $feed_id )
Deletes a single Feed.
Parameters
- $feed_id
- The ID of the Feed to delete.
Returns
boolean|WP_Error True if successful, or a WP_Error instance.
Since
1.8
|
public static
integer|WP_Error
|
#
update_feed( integer $feed_id, array $feed_meta, null $form_id = null )
Updates a feed.
Parameters
- $feed_id
- The ID of the feed being updated.
- $feed_meta
- The feed meta to replace the existing feed meta.
- $form_id
- The ID of the form that the feed is associated with
Returns
integer|WP_Error The number of rows updated or a WP_Error instance
|
public static
integer|WP_Error
|
#
add_feed( integer $form_id, array $feed_meta, string $addon_slug )
Adds a feed with the given Feed object.
Adds a feed with the given Feed object.
Parameters
- $form_id
- The ID of the form to which the feed belongs.
- $feed_meta
- The Feed Object.
- $addon_slug
- The slug of the add-on to which the feeds belong.
Returns
integer|WP_Error Either the ID of the newly created feed or a WP_Error instance.
Since
1.8
|
public static
array
|
#
send_notifications( array $form, array $entry, string $event = 'form_submission', array $data = array() )
Sends all active notifications for a form given an entry object and an
event.
Sends all active notifications for a form given an entry object and an
event.
Parameters
- $form
- The Form Object associated with the notification.
- $entry
- The Entry Object associated with the triggered event.
- $event
- Optional. The event that's firing the notification. Defaults to
'form_submission'.
- $data
- Optional. Array of data which can be used in the notifications via the generic
{object:property} merge tag. Defaults to empty array.
Returns
array The array of notification IDs sent.
Since
Unknown
Uses
GFCommon::log_debug()
GFCommon::send_notifications()
|
public static
boolean
|
#
current_user_can_any( array|string $capabilities )
Checks the permissions for the current user. Returns true if the current user
has any of the specified capabilities.
Checks the permissions for the current user. Returns true if the current user
has any of the specified capabilities.
IMPORTANT: Call this before calling any of the other API Functions as
permission checks are not performed at lower levels.
Parameters
- $capabilities
- An array of capabilities, or a single capability
Returns
boolean Returns true if the current user has any of the specified capabilities
Since
1.8.5.10
Uses
GFCommon::current_user_can_any()
|
public static
GF_Field[]
|
#
get_fields_by_type( array $form, array|string $types, boolean $use_input_type = false )
Returns an array containing the form fields of the specified type or
types.
Returns an array containing the form fields of the specified type or
types.
Parameters
- $form
- The Form Object.
- $types
- The field types to get. Multiple field types as an array or a single type in a
string.
- $use_input_type
- Optional. Defaults to false.
Returns
GF_Field[] GF_Field[]
Since
1.9.9.8
Uses
GFFormsModel::get_fields_by_type()
Used by
|
public static
GF_Field|false
|
#
get_field( array|integer $form_or_id, string|integer $field_id )
Returns the field object for the requested field or input ID from the
supplied or specified form.
Returns the field object for the requested field or input ID from the
supplied or specified form.
Parameters
- $form_or_id
- The Form Object or ID.
- $field_id
- The field or input ID.
Returns
GF_Field|false GF_Field|false
Since
2.3
Uses
GFFormsModel::get_field()
|
public static
|
#
form_id_exists( mixed $form_id )
Checks whether a form ID exists.
Checks whether a form ID exists.
Since
1.8
Used by
|
public static
boolean
|
#
entry_exists( integer $entry_id )
Checks if an entry exists for the supplied ID.
Checks if an entry exists for the supplied ID.
Parameters
- $entry_id
- The ID to be checked.
Returns
boolean bool
Since
2.4.5.8
|