Notifications Object

Notifications Object

IntroductionUsageNotification PropertiesRouting Rule PropertiesNotification JSON

Introduction

The Notifications object is an associative array containing the properties for all the email notifications which exist for a form. On a default installation when a new form is created a single notification, named Admin Notification, is created for the form. There is no limit to the number of additional notifications you can create.

See the Configuring Notifications In Gravity Forms article for a tutorial showing how you can configure notifications in the admin.

$form['notifications'] = array(
'558a90489ced3' => array(
'isActive' => true,
'id' => '558a90489ced3',
'name' => 'Admin Notification',
'event' => 'form_submission',
'to' => '{admin_email}',
'toType' => 'email',
'subject' => 'New submission from {form_title}',
'message' => '{all_fields}',
'from' => '{admin_email}',
'disableAutoformat' => false,
'enableAttachments' => false
),
'558a905b98b18' => array(
'isActive' => true,
'id' => '558a905b98b18',
'name' => 'User Notification',
'event' => 'form_submission',
'to' => '2',
'toType' => 'field',
'subject' => 'Thanks for your form submission',
'message' => '{all_fields}',
'from' => '{admin_email}',
'conditionalLogic' => array(
'actionType' => 'show',
'logicType' => 'all',
'rules' => array(
array(
'fieldId' => '3',
'operator' => 'is',
'value' => 'Email me a copy',
),
),
),
'disableAutoformat' => false,
'enableAttachments' => false
),
);

Usage

The Notification Object is part of the Form Object and so is most commonly accessed like so:

$notifications = $form['notifications'];

Notification Properties
Each notification is an associative array which can use the following properties.

isActive boolean
Is the notification active or inactive. The default is true (active).

id string
The notification ID. A 13 character unique ID.

name string
The notification name.

service string
The name of the service to be used when sending this notification. Default is wordpress.

event string
The notification event. Default is form_submission.

to string
The ID of an email field, an email address or merge tag to be used as the email to address.

toType string
Identifies what to use for the notification to. Possible values: email, field, routing or hidden

bcc string
The email or merge tags to be used as the email bcc address.

subject string
The email subject line. Merge tags supported.

message string
The email body/content. Merge tags supported.

from string
The email or merge tag to be used as the email from address.

fromName string
The text or merge tag to be used as the email from name.

replyTo string
The email or merge tags to be used as the email reply to address.

routing array
An indexed array containing the routing rules. See Routing Rule Properties properties for each rule.

conditionalLogic array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

disableAutoformat boolean
Determines if the email message should be formatted so that paragraphs are automatically added for new lines. Default is false (auto-formatting enabled).

enableAttachments boolean
Determines if files uploaded on the form should be included when the notification is sent.

Routing Rule Properties
Each routing rule is an associative array containing the following properties.
array(
'fieldId' => '3',
'operator' => 'is',
'value' => 'Email me a copy',
'email' => '{admin_email}',
)

fieldId string
Target field ID. The field that will have it』s value compared with the value property to determine if this rule is a match.

operator string
Operator to be used when evaluating this rule. Possible values: is, isnot, >, <, contains, starts_with, or ends_with. value string The value to compare with the field specified by fieldId. email string The email or merge tag to be used as the email To address if this rule is a match. Notification JSON This example shows how a basic notification array would look when formatted as JSON for use by the Gravity Forms CLI Add-On. { "id": "5acf8e9cf2b40", "to": "{admin_email}", "name": "Admin Notification", "event": "form_submission", "toType": "email", "subject": "New submission from {form_title}", "message": "{all_fields}" }

Managing Fields with WP-CLI

Managing Fields with WP-CLI

Creating FieldsExamplesParametersDeleting FieldsExamplesParametersDuplicating FieldsExamplesParametersEditing FieldsExamplesParametersGetting FieldsExamplesParametersListing FieldsExamplesParametersUpdating FieldsExamplesParameters

When using the CLI Add-On for Gravity Forms, you are able to easily manage your forms fields using only the command line, via WP-CLI. In this article, we will show you how to do things such as update, delete, and even create form fields using WP-CLI.
Creating Fields
wp gf field create
Examples

Create a new text type field for form 1.
wp gf field create 1 text 'My Text Field'

Create a new select field for form 1 from the supplied JSON.
wp gf field create 2 --field-json='{"type": "select", "label": "My Dropdown", "enableChoiceValue": true, "choices": [{"text": "Choice 1", "value":"one"}, {"text": "Choice 2", "value":"two"}]}'

Parameters

Argument
Description

The ID of the form to create a field in.


The type of field to create.Examples: text, textarea, email.See the type properties of the field classes which extend GF_Field.

[

[--field-json=]
The JSON formatted field properties.

[--porcelain]
Outputs just the created field ID.

Deleting Fields
wp gf field delete
Examples

Deletes field 2 from form 5.
wp gf field delete 5 2

Parameters

Argument
Description

The ID of the form that a field will be deleted from.


The ID of the field to be deleted.

Duplicating Fields
wp gf field duplicate
Examples

Duplicates field 2 of form 5.
wp gf field duplicate 5 2

Parameters

Argument
Description

The ID of the form that a field will be duplicated in.


The ID of the field to be duplicated.

Editing Fields
wp gf field edit
Examples

Launch the editor for field 2 of form 5.
wp gf field edit 5 2

Parameters

Argument
Description

The ID of the form that contains the field you want to edit.


The ID of the field to be edited.

Getting Fields
wp gf field get
Examples

Gets the JSON for field 2 of form 5.
wp gf field get 5 2

Parameters

Argument
Description

The ID of the form that contains the field you want to view.


The ID of the field you want to view.

Listing Fields
wp gf field list
Examples

Get a table formatted list of fields from form 5.
wp gf field list 5

Parameters

Argument
Description

The ID of the form that you want to list fields from.

[--format=]
Defines the format in which the fields will be listed.Accepted values: table, csv, json, yaml, and count.Default: table.

Updating Fields
wp gf field update
Examples

Updates field 2 of form 5 with the supplied JSON.
wp gf field update 5 2 --field-json='{"type": "text", "label": "My New Label", "defaultValue": "Just testing"}'

Update the specified properties of form 2 field 5.
wp gf field update 5 2 --type=text --label='My New Label'

Parameters

Argument
Description

The ID of the form that contains the field that will be updated.


The ID of the field you want to update.

[--=]
The field property and value to be updated.

[--field-json=]
The JSON formatted field properties.

My Download Is Not a Zip File?

My Download Is Not a Zip File?

IssueProbable Cause

Issue
To install a WordPress plugin, you need a zip file, which is how we provide Gravity Forms and Gravity Forms add-ons upon download. But what if your download is not a zip file?
Probable Cause
This likely means you that your browser is automatically opening (unzipping) the file at the time of download. This is a user preference within your browser settings.
For example, in Safari:

Open Safari >Preferences >General
Uncheck 「Open Safe Files After Downloading」
Re-download the file.

Screenshot shows Safari Preferences panel, as of Safari 14.0

Migrating from the Legacy Version of the Constant Contact Add-On

Migrating from the Legacy Version of the Constant Contact Add-On

If you』re using the legacy third-party Constant Contact Add-On created by Katz Web Services, Inc., you will need to recreate your feed settings in the new official Add-On by Gravity Forms. The legacy add-on uses an old version of the Constant Contact API (v2) and will receive no further updates.
Both add-ons may be run side-by-side. This allows you to transition your feed configuration from the legacy version to the official version created by Gravity Forms.
If you need to add contacts to multiple lists, you can create a feed for one list first, then duplicate the feed and update the list in the 「Constant Contact List」 setting. This allows you to add contacts to multiple lists.
Below are changes which will impact creating your new feeds in the Gravity Forms version using Constant Contact』s v3 API:

Middle Name is no longer available as a Map Field. Use a custom field if this information needs to be gathered.
Address 2 is no longer available as a Map Field. Use a custom field if this information needs to be gathered.
Address 3 is no longer available as a Map Field. Use a custom field if this information needs to be gathered.
The list of available Custom Fields for mapping pulls the custom fields which have been created in your Constant Contact account.

To transition your feeds to the Gravity Forms version, load the old feed setup and create a new feed with the same configuration with the above differences.

Managing Form Notifications with WP-CLI

Managing Form Notifications with WP-CLI

Listing Form NotificationsExamplesParametersCreating Form NotificationsExamplesParametersGetting Form NotificationsExamplesParametersDeleting Form NotificationsExamplesParametersDuplicating Form NotificationsExamplesParametersUpdating Form NotificationsExamplesParametersEditing Form NotificationsExamplesParameters

By using the CLI Add-On for Gravity Forms, you can easily manage form notifications using the command line.
Listing Form Notifications
wp gf form notification list
Examples

Outputs a table listing the notifications for form 1.
wp gf form notification list 1

Outputs a table listing the active notifications for form 1.
wp gf form notification list 1 --active

Outputs the raw properties for the form 1 notifications.
wp gf form notification list 1 --raw

Parameters

Argument
Description

The ID of the form to retrieve the notifications from.

[--active]
Retrieves only active notifications.

[--format=]
Defines the format in which the notifications will be listed.Accepted values: table, ids, csv, json, yaml, and count.Defaults to table.

[--raw]
Outputs the raw notification properties as a JSON string.

Creating Form Notifications
wp gf form notification create
Examples

Creates a new notification for form 1 with the specified name.
wp gf form notification create 1 'My Notification'

Creates a new notification for form 1 with the specified name and to address.
wp gf form notification create 1 'My Notification' --to='[email protected]'

Parameters

Argument
Description

The ID of the form to create the notification for.

[]
The name to be assigned to the new notification.

[--to=]
The to field value.Default: {admin_email}.

[--subject=]
The subject field value.Default: New submission from {form_title}.

[--message=]
The message field value.Default: {all_fields}.

[--to-type=]
The send to type field value.Default: email.

[--event=]
The event field value; when the notification will be sent.Default: form_submission.

[--notification-json=]
The JSON formatted notification.

[--porcelain]
Outputs just the notification ID instead of the standard success message.

Getting Form Notifications
wp gf form notification get
Examples

Gets the JSON for the specified notification from form 1.
wp gf form notification get 1 596e4794a13a2

Parameters

Argument
Description

The ID of the form to get the notification from.


The ID of the notification to get.

Deleting Form Notifications
wp gf form notification delete
Examples

Deletes the specified form 1 notification.
wp gf form notification delete 1 596e4794a13a2

Deletes the specified form 1 notifications.
wp gf form notification delete 1 596e4794a13a2 574ff8257d864

Parameters

Argument
Description

The ID of the form to delete the notification from.

...
The IDs of the notification to delete.

Duplicating Form Notifications
wp gf form notification duplicate
Examples

Duplicates the specified form 1 notification.
wp gf form notification duplicate 1 596e4794a13a2

Parameters

Argument
Description

The ID of the form to duplicate the notification for.


The ID of the notification to duplicate.

[--porcelain]
Outputs just the new notification ID instead of the standard success message.

Updating Form Notifications
wp gf form notification update
Examples

Updates the specified form 1 notification from the supplied JSON.
wp gf form notification update 1 --notification-json='{snip}'

Updates the specified notification using the supplied JSON.
wp gf form notification update 1 abc1 --notification-json='{snip}'

Parameters

Argument
Description

The ID of the form to update the notification for.

[]
The ID of the notification to be updated.

[--notification-json=]
The JSON formatted notification.

Editing Form Notifications
wp gf form notification edit
Examples

Launch the editor for the specified form notification.
wp gf form notification edit 1 596e4794a13a2

Parameters

Argument
Description

The ID of the form the notification to be edited belongs to.


The ID of the notification to edit.

Name Fields CSS Selectors

Name Fields CSS Selectors

First NameContainerInputLabelLast NameContainerInputLabel

First Name
Container
example: name – first name container (span) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .name_first {border: 1px solid red;}
example: name – first name container (span) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .name_first {border: 1px solid red;}
example: name – first name container (span) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .name_first {border: 1px solid red;}
Input
example: name – first name field (input) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .name_first input {border: 1px solid red;}
example: name – first name field (input) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .name_first input {border: 1px solid red;}
example: name – first name field (input) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .name_first input {border: 1px solid red;}
Label
example: name – first name sub-label (label) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .name_first label {color: red;}
example: name – first name sub-label (label) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .name_first label {color: red;}
example: name – first name sub-label (label) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .name_first label {color: red;}
Last Name
Container
example: name – last name container (span) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .name_last {border: 1px solid red;}
example: name – last name container (span) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .name_last {border: 1px solid red;}
example: name – last name container (span) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .name_last {border: 1px solid red;}
Input
example: name – last name field (input) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .name_last input {border: 1px solid red;}
example: name – last name field (input) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .name_last input {border: 1px solid red;}
example: name – last name field (input) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .name_last input {border: 1px solid red;}
Label
example: name – last name sub-label (label) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .name_last label {color: red;}
example: name – last name sub-label (label) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .name_last label {color: red;}
example: name – last name sub-label (label) – applies just to specific container (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body #gform_wrapper_1 .gform_body .gform_fields #field_XX_X.gfield .name_last label {color: red;}

Remove an Application from your Mailchimp Account

Remove an Application from your Mailchimp Account

IntroductionStepsReference

Introduction

Our Mailchimp Add-On now uses an upgraded OAuth authentication method, which upon connection and validation, creates an authorized app within your Mailchimp account.

This article shows how to revoke that access, by describing how to remove the app from your authorized list.

Steps

To remove an application from your list of authorized applications, follow these steps.

Log in to mailchimp.com with a web browser.Click your profile icon and choose Account.Click the Extras drop-down menu and choose API keys.In the Authorized applications section, click the 「X」 next to the application you need to remove.

Reference

For more information, see this Mailchimp article.

Logging and Debugging

Logging and Debugging

IntroductionEnabling LoggingWarning MessageLogging SettingsViewing LogsDeleting Logs

Introduction

For quite a while, enabling logging has been a go-to method for debugging any issues within Gravity Forms. As of Gravity Forms version 2.2, logging functionality has been moved from being a separate add-on, and is now a core feature.

In this article, we will show you how to enable and configure logging within Gravity Forms.

Note: If you have the a role management plugin active, such as Members, you』ll need to ensure that your user has the correct permissions active to acccess logging.

Enabling Logging

To enable logging, simply enable it within the Gravity Forms settings page.

Access the Settings page by hovering over Forms on the left side menu within your WordPress dashboard, then click on Settings Next, scroll down to Logging and set it to On.

Once complete, don』t forget to save your settings.

If you』re going to send the system report or logs to support, keep logging on until the end of the issue resolution. If you turn off logging before that the logs will be deleted!

Warning Message

As of Gravity Forms 2.4, the following non-dismissible security notice will be displayed on every WordPress admin page when logging is enabled:

This is because log files can contain sensitive information stored in plain text, and should not be left running, nor left in an insecure network accessible server for extended periods.

If you enabled logging per support service request, you need to keep logging enabled during the ticket handling to allow the support staff to check your logs. When logging is disabled, the logs are deleted.

The message can be removed by turning off logging using Gravity Forms > Settings or by adding the GF_LOGGING_DISABLE_NOTICE constant to your wp-config.php file and setting it to true.

define( 'GF_LOGGING_DISABLE_NOTICE', true );

Logging Settings

Once logging is enabled within your Gravity Forms settings, an additional Settings item will appear labeled Logging. To configure any settings related to logging in Gravity Forms, simply access this tab.

Within the Logging tab, you』ll see Gravity Forms as well as any Gravity Forms add-ons that you have installed. Each of these can be configured to enable/disable logging, as well as make changes to the information that is logged.

If you』ve narrowed down exactly where you』re having issues, you might want to enable any additional add-ons.

Viewing Logs

To access the logs that are generated, take a look at the Logging tab of the Settings page. Below each item, you will see links to view or delete the logs for that particular item.

If you don』t see these things, be sure that logging has been enabled, and logs have been generated. If nothing exists within the logs, a link to display them will not appear.

Also note log files have a maximum size of 5MB, once a log file gets bigger, it』s renamed and a brand new log file with the original name is created to store additional logging messages. You can download rotated log files from /wp-content/uploads/gravity_forms/logs/ using a FTP client.

Deleting Logs

Logs are deleted almost exactly the same as they are viewed. To delete your logs, simply click on the Delete Logs link instead of the View Logs link on the logging settings tab.

Managing the Gravity Forms License Key with WP-CLI

Managing the Gravity Forms License Key with WP-CLI

Updating the License KeyExamplesParametersDeleting the License KeyExamples

Using the Gravity Forms CLI Add-On and the following commands you can update and delete the Gravity Forms license key from the command line.
Updating the License Key
wp gf license update
Updates the Gravity Forms license key.
Examples
123# Updating the plugin to use the specified license key.$ wp gf license update abc123License key updated
Parameters

Argument
Description

[]
A valid Gravity Forms license key.

Deleting the License Key
wp gf license delete
Deletes the Gravity Forms license key.
Examples
123# Deleting license key from the plugin.$ wp gf license deleteLicense key deleted

Mailchimp Feed Meta

Mailchimp Feed Meta

IntroductionUsagePropertiesGroups

Introduction
The Feed Object meta for the Mailchimp add-on is an associative array containing the properties which determine how the add-on should process the form submission.
1234567$feed['meta'] = array(    'feedName'                                => 'Your Feed Name',    'feed_condition_conditional_logic'        => true,    'feed_condition_conditional_logic_object' => array(        'conditionalLogic' => array(),    ),);
Usage
We recommend accessing the $feed meta using the rgar() or rgars() functions, e.g.:
1$conditional_logic_enabled = rgars( $feed, 'meta/feed_condition_conditional_logic' );

Properties

feedName string
The feed name which appears on the add-ons feeds tab.

mailchimpList string
The API List ID for the Mailchimp list this feed will subscribe the user to when processed.

mappedFields_EMAIL string
The ID of the field containing the user』s email address.

mappedFields_FNAME string
The ID of the field containing the user』s first name.

mappedFields_FNAME string
The ID of the field containing the user』s first name.

mappedFields_{tag} string
The ID of the field containing the value for the list field.
There would also be properties for any other List fields and *|MERGE|* tags configured for your list, they all begin mappedFields_ and then end with the tag, e.g. mappedFields_MMERGE3.

feed_condition_conditional_logic boolean
Is the feed condition (conditional logic) setting enabled. Default is false.

feed_condition_conditional_logic_object array
An associative array containing the conditional logic rules. See the Conditional Logic Object for more details.

Groups
If the Mailchimp List has any groups configured, the following properties will be added for each group. {GROUPID} is a 13 character unique ID generated by the add-on to identify the group.

mc_group_{GROUPID}_enabled boolean
Should the user be added to the group.

mc_group_{GROUPID}_decision string
Should the user always be added to the group or only if the configured condition is met. Possible values: if or always.

mc_group_{GROUPID}_field_id string
The ID of the field containing the value which should be compared against mc_group_{GROUPID}_value.

mc_group_{GROUPID}_operator string
Operator to be used when evaluating this rule. Possible values: is, isnot, >, <, contains, starts_with, or ends_with. mc_group_{GROUPID}_value string The value required for the user to be added to the group.