Setting Up the CleverReach Add-On

Setting Up the CleverReach Add-On

Pre-RequisitesSetupAdd-On Framework Hooks

Pre-Requisites

Download and install the add-on
A CleverReach account
The PHP extension PHP Soap must also be present on your web server. Most web hosts will already have this PHP extension installed and enabled.

Setup

Log into your WordPress admin dashboard.
On the left side navigation menu, hover over Forms and click on Settings.
From this page, click the CleverReach tab.
Enter your Customer ID, Username, and Password. This is obtained from CleverReach.
Click Update Settings. If you』ve entered your account information correctly, you will be notified by green check marks beside each box. If you do not see green check marks, please double check this information and try again.

Once you have entered your API key, you』re ready to begin creating a feed for the CleverReach Add-On.
Add-On Framework Hooks
Because the CleverReach Add-On is built using the Add-On Framework it also inherits any hooks available in the framework methods it uses such as:

gform_short_slug_field_value for changing a field value before it is passed to CleverReach.

Checking Your Environment Details

Checking Your Environment Details

Accessing the System Status PageSending System ReportsUnderstanding the System Status PageGravity Forms EnvironmentGravity FormsAdd-OnsDatabaseWordPress EnvironmentWordPressActive ThemeActive PluginsServer EnvironmentWeb ServerPHPMySQL

As of Gravity Forms 2.2, it』s possible to see full details on your hosting environment from directly within Gravity Forms. Investigating your environment details is one of the first and most helpful steps when troubleshooting an issue.

Accessing the System Status Page

To access your environment details, simply access the System Status page. To do so, hover over Forms on the left side menu in your WordPress admin, and click on System Status.

If the System Status menu item is missing on your site there are two possibilities:

The site is running a version of Gravity Forms which is older than 2.2, please update to the latest version.Your user role does not have the gravityforms_system_status capability enabled. You can use a role management plugin such as Members to enable the plugin capabilities for roles.

Sending System Reports

System reports can easily be sent by simply clicking on the Copy System Report button at the top of the page. Upon clicking on it, a fully text-based copy of the report will be automatically sent to your clipboard and can be pasted anywhere. This is especially useful to send when submitting a support request.

If you find the system report does not copy to the clipboard you will want to run through a theme/plugin conflict test.

Understanding the System Status Page

Within the System Status page, there are several items listed and grouped together.

Gravity Forms Environment

This section contains various information that directly impacts Gravity Forms.

Gravity Forms

ItemDescriptionVersionThe version of Gravity Forms that is currently active.Upload folderThe absolute path to the folder that Gravity Forms will use for file uploads.Upload folder permissionsThe permissions that Gravity Forms has for your upload folder. It should display Writeable. If not, you may have issues with file upload fields.Output CSSIndicates if outputting of the form stylesheets is enabled or disabled.Output HTML5Indicates if the form fields should use the available HTML5 input types.No-Conflict ModeIndicates if extraneous scripts and styles are being prevented from inclusion on Gravity Forms admin pages, reducing conflicts with other plugins and themes.CurrencyThe currency code the forms are configured to use.Background updatesIndicates if Gravity Forms can download and install bug fixes and security updates automatically in the background.LocaleThe locale code being used by WordPress when loading the Gravity Forms translations.

Add-Ons

This section will list all Gravity Forms add-ons currently activated on your site, as well as the creator. Official add-ons will state the creator as Gravity Forms. 3rd party add-ons will show a different creator.

Database

Inside the Database section, information relating to Gravity Forms database tables will be listed. This includes the version number of the Gravity Forms database, as well as the status of the database tables used by Gravity Forms.

Within this section, you can also re-run the database upgrade. If you』re having database-related issues, especially after an update, re-running the database upgrade can often solve them.

WordPress Environment

This section contains various details about your WordPress installation.

WordPress

This section includes general information about your WordPress installation.

ItemDescriptionHome URL and Site URLThe URLs assigned to your WordPress site. Typically, unless you have a specific reason otherwise, these should be the same.WordPress VersionThe version of WordPress that you are running.WordPress MultisiteIf this is a multisite installation, it will appear here.WordPress Memory LimitIn addition to your memory limit within your PHP configuration, WordPress also sets its own memory limits. The WordPress Memory Limit list item will display the currently set memory limit, as defined within WordPress.WordPress Debug Mode, WordPress Debug Log, and WordPress Script Debug ModeIf debugging is enabled on the site using the WP_DEBUG constant, the mode will be displayed, as well as the log may be enabled. If WP_DEBUG is not turned on, they will both display No.WordPress CronIndicates if the cron is enabled or has been disabled using the DISABLE_WP_CRON constant.WordPress Alternate CronIndicates if the alternative, redirect based cron, has been enabled using the ALTERNATE_WP_CRON constant.Background tasksIndicates if your site is able to send a post request to it』s Admin Ajax URL using the WordPress HTTP API to trigger processing of queued tasks. If there is an issue an error message or status code from the test request response will be displayed.

Active Theme

The active theme section will provide information regarding the active theme and it』s parent theme (if applicable).

Active Plugins

The active plugins section will provide information regarding what plugins are installed and activated on your site, along with the version number.

Server Environment

These status items display information related to your server and hosting environment. Often times, you will need to contact your web host if there are any issues here.

Web Server

The Web Server section displays information about the software that serves your pages, typically Apache or NGINX. It also includes the document root that the site is being displayed and the port that it is running on (usually ports 80 or 443).

PHP

Inside the PHP section, you』ll see information related to PHP options that may impact your site. The most notable of these is Version, which should be as high as possible (PHP 7.1 or newer is recommended).

We won』t go over all of the items displayed here, but more details related to PHP configurations can be found on the PHP documentation site.

MySQL

Lastly, details on the MySQL database are displayed, such as the version, character set, and collation.

Checkboxes

Checkboxes

SummaryCommon SettingsGeneral SettingsNotesMerge TagsUsageModifiersCalculations

Summary

The Checkboxes field allows you to present one or many checkboxes which allow multiple selections. It is available under the Standard Fields section within the form editor.

Checkboxes field as displayed in the Field Library

Checkboxes field as displayed in the Form Editor.

Important: If your choice labels contain any HTML or special characters such as ampersands, commas, hyphens or brackets of any type, you MUST enable the show values feature and give each choice a simple and unique value which does not contain any special characters. Failure to configure values could cause issues for features such as calculations, conditional logic, dynamic population, and validation.

Important: Once the form has entries the choices should not be changed. Adding, removing, re-ordering, or renaming checkbox choices will result in the input ids associated with the choices changing which could break the connection to the choices already stored in the existing entries and prevent them being exported.

Common Settings

This field uses only common field settings for the Appearance and Advanced settings. For a description of each of the common field settings, refer to this article. Below you will find a description of specialty settings that are particular to this field.

General Settings

SettingDescriptionChoicesAdd Choices to this field. You can mark each choice as checked by default by using the checkbox that appears to the left of each choice. Add a new choice by clicking the PLUS icon and delete a choice by clicking the DELETE icon.Show ValuesChecking this option will allow you to specify a value for each choice. Choice values are not displayed to the user viewing the form, but are accessible to administrators when viewing the entry.Bulk Add / Predefined ChoicesClicking the Bulk Add / Predefined Choices allows you to select a category and customize the predefined choices or paste your own list to bulk add choices. See note 1.Enable 「Select All」 choiceChecking this adds a Select All option to the top of the checkboxes list which allows the user to select all of the available list items.

Notes

1. See this article for more information.

Merge Tags

For more information on the use of merge tags, refer to these articles.

Usage

{Field Name:2.1:modifier1}

Notes:

The field name is optional.The second parameter is the field ID. If a single number, it can be used to get the value of the field ID. If multiple numbers separated by a period, it will get a specific selection within that field. For example, 2 will return the result of field ID 2, while 2.1 will return the first checkbox within field ID 2.The third, and any subsequent parameters are used for modifiers. These are separated by a colon, and may contain multiple modifiers if applicable.

Modifiers

ModifierDescription:valueDisplays the actual value of the checkbox rather than the value label.:currencyDisplays the value as currency.:priceSame as :currency.

Calculations

If you』re going to use this field type in a calculation formula, please check Number Formatting Rules in the Calculations doc page.

Checkboxes Field CSS Selectors

Checkboxes Field CSS Selectors

ListItemsLabelsInputs

List
Unordered list used to structure all of the individual list choices

example: standard checkbox list (ul) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .gfield_checkbox {border: 1px solid red}

example: standard checkbox list (ul) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_checkbox {border: 1px solid red}

example: standard checkbox list (ul) – applies just to specific checkbox list (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_checkbox {border: 1px solid red}

Items
Individual list choices

example: standard checkbox list item (li) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .gfield_checkbox li {border: 1px solid red}

example: standard checkbox list item (li) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_checkbox li {border: 1px solid red}

example: standard checkbox list item (li) – applies just to specific checkbox list item (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_checkbox li {border: 1px solid red}

Labels

example: standard checkbox choice label – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .gfield_checkbox li label {border: 1px solid red}

example: standard checkbox choice label – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_checkbox li label {border: 1px solid red}

example: standard checkbox choice label – applies just to specific checkbox label (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_checkbox li label {border: 1px solid red}

Inputs

example: standard checkbox input (checkbox) – applies to all forms
1body .gform_wrapper .gform_body .gform_fields .gfield .gfield_checkbox li input[type=checkbox] {border: 1px solid red}

example: standard checkbox input (checkbox) – applies just to form ID #1
1body #gform_wrapper_1 .gform_body .gform_fields .gfield .gfield_checkbox li input[type=checkbox] {border: 1px solid red}

example: standard checkbox input (checkbox) – applies just to specific checkbox list inputs (based on the unique parent element ID – replace 「XX_X」 with your actual element ID)
1body .gform_wrapper .gform_body .gform_fields #field_XX_X.gfield .gfield_checkbox li input[type=checkbox] {border: 1px solid red}

Checkbox Field

Checkbox Field

IntroductionExampleUses

Introduction
The checkbox type field, part of the Settings API, renders one or more checkbox type inputs.
Example
The following example shows a section with a checkbox type field. The default_value property is set to 1 for each choice, which means the box will be checked by default. The default_value will no longer apply once the user makes a selection and submits.
You may also include other HTML attributes as properties for fields. In this example, you will see the onclick property added. This means when the onclick event fires, a javascript alert will display the text 「This is a test」.
1234567891011121314151617181920212223242526array(    'title'  => esc_html__( 'This is the title for Section 3', 'sometextdomain' ),    'fields' => array(        array(            'type'    => 'checkbox',            'name'    => 'mycheckbox',            'label'   => esc_html__( 'This is the label for my checkbox', 'sometextdomain' ),            'onclick' => 'alert("This is a test.")',            'choices' => array(                array(                    'label'         => esc_html__( 'this is the label for choice1', 'sometextdomain' ),                    'name'          => 'choice1',                    'tooltip'       => esc_html__( 'this is the tooltip for choice1', 'sometextdomain' ),                    'default_value' => 1,                 ),                array(                    'label'         => esc_html__( 'this is the label for choice2', 'sometextdomain' ),                    'name'          => 'choice2',                    'tooltip'       => esc_html__( 'this is the tooltip for choice2', 'sometextdomain' ),                    'default_value' => 1,                ),            ),        ),    ),),
The code above will render the checkbox field similar to the following:

Uses

settings_checkbox()
checkbox_item()
checkbox_input()
checkbox_input_{$choice_name}()

Checkboxed Select Field

Checkboxed Select Field

IntroductionExampleUses

Introduction
The checkbox_and_select type field, part of the Settings API, renders a checkbox which when checked will display a drop down with additional options.
Example
123456789101112131415161718192021222324252627array(    'title'  => esc_html__( 'This is the title for Section 1', 'sometextdomain' ),    'fields' => array(        array(            'name'     => 'updateContact',            'label'    => esc_html__( 'Update Contact', 'sometextdomain' ),            'type'     => 'checkbox_and_select',            'checkbox' => array(                'name'  => 'updateContactEnable',                'label' => esc_html__( 'Update Contact if already exists', 'sometextdomain' ),            ),            'select'   => array(                'name'    => 'updateContactAction',                'choices' => array(                    array(                        'label' => esc_html__( 'and replace existing data', 'sometextdomain' ),                        'value' => 'replace'                    ),                    array(                        'label' => esc_html__( 'and append new data', 'sometextdomain' ),                        'value' => 'append'                    )                )            ),        ),    ),),
The above code would render a field similar to the following:

Uses

settings_checkbox_and_select()
settings_checkbox()
settings_select()

Changing Stripe Billing Information

Changing Stripe Billing Information

PrerequisitesVersion 3.4+NotesOlder Versions

This snippet will allow you to change a customer』s billing information that has been stored within Stripe, using a form.
The current snippet is based on the original one provided to us by one of our customers, Shamai Greenfield.
Prerequisites

IMPORTANT: The user must be logged in before submitting any of the forms described below. Otherwise there』s no way to identify the user and associate WordPress and Stripe.com id』s.

To use this snippet, you will need two forms. We』ll call them Form A and Form B.
Form A will contain your standard Stripe subscription form. It creates the customer and the gform_stripe_customer_after_create snippet saves the customer id to the user meta.
Form B will be an additional form that you can use for updating the subscription. It』s used to update the billing info. This would have a product and services feed, and hidden product with at least $0.50. On submission the gform_stripe_customer_id code snippet gets the customer id from the user meta, this will be used to get the customer object which is then used to create the charge object, updating the billing info. The gform_stripe_charge_authorization_only code snippet is then used to prevent the charge being captured.
Version 3.4+
Notes

Payment method must be set to Stripe Credit Card Field.
Due to changes done by Stripe.com to the payment intents API, the card will be saved but not set as default payment method.

// Save the users' Stripe customer ID after a payment is made via a subscription Stripe feed.
add_action( 'gform_stripe_customer_after_create', 'save_stripe_customer_id' );
function save_stripe_customer_id( $customer ) {
gf_stripe()->log_debug( __METHOD__ . '(): Running...' );
if ( is_user_logged_in () ) {
$user_id = get_current_user_id();
gf_stripe()->log_debug( __METHOD__ . '(): Adding customer id ' . $customer->id . ' to user ' . $user_id );
update_user_meta( $user_id, 'stripe_customer_id', $customer->id );
}
}

// Gets the current Stripe customer ID to change the billing details on. Tests if the user has an ID and is signed in.
add_filter( 'gform_stripe_customer_id', 'get_stripe_customer_id' );
function get_stripe_customer_id( $customer_id ) {
gf_stripe()->log_debug( __METHOD__ . '(): Running...' );
if ( is_user_logged_in () && get_user_meta( get_current_user_id(), 'stripe_customer_id', true ) != ''){
$user_id = get_current_user_id();
gf_stripe()->log_debug( __METHOD__ . '(): Getting customer id from user ' . $user_id );
$customer_id = get_user_meta( $user_id, 'stripe_customer_id', true );
gf_stripe()->log_debug( __METHOD__ . '(): Customer id set to: ' . $customer_id );
}
return $customer_id;
}

// Make a form that has a Stripe Product and Services feed, and make sure no payment is made.
add_filter( 'gform_stripe_charge_authorization_only', 'stripe_charge_authorization_only', 10, 2 );
function stripe_charge_authorization_only( $authorization_only, $feed ) {
gf_stripe()->log_debug( __METHOD__ . '(): Running...' );
$feed_name = rgars( $feed, 'meta/feedName' );
// The name associated with the Stripe feed.
if ( $feed_name == 'Update Billing' ) {
gf_stripe()->log_debug( __METHOD__ . '(): Authorization only for Update Billing feed.' );
return true;
}
return $authorization_only;
}

add_filter( 'gform_stripe_charge_pre_create', function( $charge_meta, $feed, $submission_data, $form, $entry ) {
$feed_name = rgars( $feed, 'meta/feedName' );
// The name associated with the Stripe feed.
if ( $feed_name == 'Update Billing' ) {
gf_stripe()->log_debug( 'gform_stripe_charge_pre_create: running for feed ' . rgars( $feed, 'meta/feedName' ) );
$charge_meta['setup_future_usage'] = 'off_session';
}

return $charge_meta;
}, 10, 5 );

Older Versions
// Save the users' Stripe customer ID after a payment is made via a subscription Stripe feed.
add_action( 'gform_stripe_customer_after_create', 'save_stripe_customer_id' );
function save_stripe_customer_id( $customer ) {
GFCommon::log_debug( __METHOD__ . '(): Running...' );
if ( is_user_logged_in () ) {
$user_id = get_current_user_id();
GFCommon::log_debug( __METHOD__ . '(): Adding customer id ' . $customer->id . ' to user ' . $user_id );
update_user_meta( $user_id, 'stripe_customer_id', $customer->id );
}
}

// Gets the current Stripe customer ID to change the billing details on. Tests if the user has an ID and is signed in.
add_filter( 'gform_stripe_customer_id', 'get_stripe_customer_id' );
function get_stripe_customer_id( $customer_id ) {
GFCommon::log_debug( __METHOD__ . '(): Running...' );
if ( is_user_logged_in () && get_user_meta( get_current_user_id(), 'stripe_customer_id', true ) != ''){
$user_id = get_current_user_id();
GFCommon::log_debug( __METHOD__ . '(): Getting customer id from user ' . $user_id );
$customer_id = get_user_meta( $user_id, 'stripe_customer_id', true );
GFCommon::log_debug( __METHOD__ . '(): Customer id set to: ' . $customer_id );
}
return $customer_id;
}

// Make a form that has a Stripe Product and Services feed, and make sure no payment is made.
add_filter( 'gform_stripe_charge_authorization_only', 'stripe_charge_authorization_only', 10, 2 );
function stripe_charge_authorization_only( $authorization_only, $feed ) {
GFCommon::log_debug( __METHOD__ . '(): Running...' );
$feed_name = rgars( $feed, 'meta/feedName' );
// The name associated with the Stripe feed.
if ( $feed_name == 'Update Billing' ) {
GFCommon::log_debug( __METHOD__ . '(): Authorization only for Update Billing feed.' );
return true;
}
return $authorization_only;
}

Changing the Payment Description in the Stripe Add-On

Changing the Payment Description in the Stripe Add-On

If you need to change the payment description that is sent from your form to Stripe, you can do so quite easily using the gform_stripe_charge_description filter.
To do so you will need to place a bit of code within your site, such as your theme』s functions.php file or ideally, within it』s own plugin.
1234add_filter( 'gform_stripe_charge_description', 'change_stripe_description', 10, 3 );function change_stripe_description( $description, $strings, $entry ) {    return $description . '  Purchased By: ' . rgar( $entry, '1.5' );}
As you can see in the above example, the filter is being called which contains the order description, and form information. From here, we are modifying that information to contain not only the original description which is set to the $description variable, but also defining who the order was purchased by based on a field submission value.
For more information on the gform_stripe_charge_description filter, take a look at the main gform_stripe_charge_description article.

Example: Changing Your Form』s Background Color

Example: Changing Your Form』s Background Color

Where To Put Your CSS SnippetExample modifying all FormsExample modifying one Form.More Info

Where To Put Your CSS Snippet
Refer to the article linked here for advice on where you can add this snippet](https://docs.gravityforms.com/where-to-put-your-custom-css/).
Example modifying all Forms
This will change the background color for all forms by using the form wrapper element
123body .gform_wrapper {    background-color: yellow;}
Example modifying one Form.
This will target a specific form, in this case, form ID 1, as indicated by the extended element name. Refer to this article for the structure of element names.
123body #gform_wrapper_1 {    background-color: yellow;}
More Info
See this article for dozens more examples of using CSS to target your form elements.

Example: Changing Font Sizes

Example: Changing Font Sizes

IntroductionEntire Form ExampleField Headers ExampleField Inputs ExampleSpecific Field ExampleMore Info

Introduction
By default, Gravity Forms will utilize your current theme』s stying, but in some cases, you may need to change your font size that your theme defines. This article shows a few simple techniques you can try using CSS.
Refer to the article linked here for advice on where you can add this snippet.
Entire Form Example
This example would change the font size for all text in the form:
body .gform_wrapper .gform_body {
font-size: 18px;
}

Field Headers Example
The following will change the font size on all field labels on the form:
body .gform_wrapper .gform_body .gfield_label {
font-size: 18px;
}

Field Inputs Example
The following will change the font size on all inputs on the form:
body .gform_wrapper .gform_body input {
font-size: 18px;
}

Specific Field Example
The following will change the font size on the input of the specific field #1 on the form #6:
#field_6_1.gfield input {
font-size: 18px;
}

Alternately, you can target the input directly by it』s ID #input_6_1 in the example above.
More Info
See this article for dozens more examples of using CSS to target your form elements.