Using Gravity Forms to Create New Sites Within Multisite

Using Gravity Forms to Create New Sites Within Multisite

IntroductionPre-RequisitesSteps

Introduction

When running a multisite network in WordPress, you may need to create new sites within your network straight from a registration form. The User Registration Add-On for Gravity Forms enables this fairly easily. Here, we will show you how.

Pre-Requisites

Installed the User Registration Add-On.created a form within Gravity Forms, This article also assumes that you have an existing understanding of using the User Registration add-on.

Steps

Navigate to your registration form.From the Settings menu, select User Registration.Create a new feed by clicking the Add New button.

On the settings page, after the Action and Gravity Form options are selected, you will see a heading labeled Network Options. Select the checkbox labeled Create new site when a user registers.Additional options will appear. These are the options that will be used to create the new site once the form is submitted. Map the form field for each of these options.

Once activated, this feed will create a new site within a multisite network within Gravity Forms.

If you would like more information on the User Registration Add-On, refer to the User Registration Add-On documentation category.

Creating a Feed for the PayPal Payments Standard Add-On

Creating a Feed for the PayPal Payments Standard Add-On

SummaryCreate a FeedFeed Settings ScreenOther SettingsFeed Notifications Setup

Summary

Before the PayPal Payments Standard Add-On can be used with Gravity Forms, you will first need to create a feed. A feed simply allows form submission data to be sent to another source. In this instance, payment data being sent to PayPal.

Create a Feed

To create a feed to PayPal Payments Standard using the PayPal Payments Standard Add-On for Gravity Forms, do the following from your WordPress Admin Dashboard:

Click on Forms in the left side menu.Select the form that you want to use with PayPal Payments Standard.Once within your desired form, hover over Settings and click on PayPal Payments Standard.Click Add New to create a new feed. You will be presented with the PayPal Payments Standard feed settings screen.

Note: You can create multiple PayPal Payments Standard feeds for your form; however, you must configure conditional logic on them. The PayPal Payments Standard Add-On will only process one feed during submission; if conditional logic is not configured, it will use the first feed it finds.

Feed Settings Screen

The following fields are available within the settings screen. Refer to the settings screenshots below.

A feed Name is required. It is only used for identification and will not be shown anywhere other than your feed listing.In the PayPal Email Address field, enter the email address for the PayPal account that will be receiving payments.The Mode field determines if you want to receive live payments or are submitting them to PayPal in sandbox mode for testing. If you』re ready to take payments live, set this to Production. Otherwise, set it to Test.Select the Transaction Type. If you are selling a one-time physical or digital product, you will typically select the Product and Services option. If you are selling a recurring subscription or accepting donations, you will want to select the respective option.

After you have selected your desired option within the Transaction Type dropdown, you will see various other fields appear that are specific to the option you have selected, in addition to other options below it. For more information on the fields that are specific to your transaction type, you may review the following articles:

The PayPal Payments Standard Products and Services Transaction Type

The PayPal Payments Standard Subscription Transaction Type

The PayPal Payments Standard Donations Transaction Type

Other Settings

Under the Other Settings section, there are several other options that can be configured. These options are the same regardless of the transaction type you select.

Billing Information configures what billing information is sent to PayPal when processing a transaction. Map each of the billing fields to the desired form field that will contain that information.The Image URL option allows you to enter the URL of the image displayed as your logo in the upper left order of the PayPal checkout pages.The Cancel URL option lets you customize the URL that users will be sent to if they cancel their order within PayPal before completion.

Options: These checkboxes allow you to better control the information that is obtained from PayPal. If you do not need to pass the address on to PayPal, enable the checkbox labeled Do not prompt buyer to include a shipping address. The same applies for passing a note.Some users may see a deprecated section titled Notifications. This section is only visible if the feed were previously configured to control notifications this way. See the Notifications section below for details on how to control when notifications are sent based on Events.Conditional Logic: If unchecked, every successful form submission will be sent to PayPal. If you wish to set specific conditions for sending form data to PayPal, then check the 「Enable Condition」 box and fill out your required criteria.Click the Update Settings button to save your options.

Feed Notifications Setup

Controlling when notifications are sent used to be available in the Feed Setup. This has been removed and is now controlled from the Notification itself.

Click on the Notifications menu in the left navigation.

Hover over the name of the notification you wish to modify and click Edit, or create a new notification. An Event section with the actions available for sending notifications will display.

Expand the drop down for the Event section and select the Event for which you want a notification sent. If you need to send notifications for more than one event, simply create another notification.Fill out the rest of the notification and click Update Notification or Save Notification, depending on whether this is an existing or new notification.

Create a Customer in Stripe without Capturing Payment

Create a Customer in Stripe without Capturing Payment

You can create a customer in your Stripe.com dashboard, including their payment details, without actually charging the customer. The method you use to do this will depend on which version of the Stripe add-on you are using:

IMPORTANT: The following requires our Stripe Add-On version 3.4 or newer.
Payment method must be set to Stripe Credit Card Field.

Go to Form Settings > Stripe > Add New.Give the new feed a name and for the transaction type select Product and Services.The payment amount can be set to either the form total or a product field, it doesn』t matter which as long as the amount is greater than zero and conforms to Stripe.com minimum amount requirements, the customer won』t actually be charged.Map the Stripe Receipt setting to the form field which contains the customers email address.Add the following code snippets as usual, replacing feed name goes here with the actual name of your feed.

add_filter( 'gform_stripe_customer_id', function ( $customer_id, $feed, $entry, $form ) {
gf_stripe()->log_debug( __METHOD__ . '(): running customer creation snippet.' );
if ( rgars( $feed, 'meta/transactionType' ) == 'product' && rgars( $feed, 'meta/feedName' ) == 'feed name goes here' ) {
gf_stripe()->log_debug( __METHOD__ . '(): Working for feed ' . rgars( $feed, 'meta/feedName' ) );
$customer_meta = array();

$email_field = rgars( $feed, 'meta/receipt_field' );
if ( ! empty( $email_field ) && strtolower( $email_field ) !== 'do not send receipt' ) {
$customer_meta['email'] = gf_stripe()->get_field_value( $form, $entry, $email_field );
}

$customer = gf_stripe()->create_customer( $customer_meta, $feed, $entry, $form );
gf_stripe()->log_debug( __METHOD__ . '(): Returning Customer ID ' . $customer->id );

return $customer->id;
}

return $customer_id;
}, 10, 4 );

add_filter( 'gform_stripe_charge_authorization_only', function ( $authorization_only, $feed ) {
if ( rgars( $feed, 'meta/feedName' ) == 'feed name goes here' ) {
gf_stripe()->log_debug( __METHOD__ . '(): Authorization only for feed ' . rgars( $feed, 'meta/feedName' ) );
return true;
}

return $authorization_only;
}, 10, 2 );

add_filter( 'gform_stripe_charge_pre_create', function( $charge_meta, $feed, $submission_data, $form, $entry ) {
if ( rgars( $feed, 'meta/feedName' ) == 'feed name goes here' ) {
gf_stripe()->log_debug( __METHOD__ . '(): Adding setup_future_usage for feed ' . rgars( $feed, 'meta/feedName' ) );
$charge_meta['setup_future_usage'] = 'off_session';
}

return $charge_meta;
}, 10, 5 );

When the form is submitted and passes validation the customer will be created in your Stripe account. A charge will also be created based on how the feed is configured but it will not be captured when the entry is saved.

Please note that Stripe will automatically expire the authorized charges if not captured within seven days.

Create Content Template

Create Content Template

Checking the Create Content Template option allows you to format and insert form fields as the content of the field. This option is available on the Post Title, Post Body, and Post Custom Field fields (only when Field Type is set to Single line text or Paragraph Text).

After checking to enable this option, a dropdown with a list of available form fields (and other form/user/date related options) will appear. Selecting a form field from this list will automatically insert a token into the content template textarea. This token will then be replaced with the submitted value for the specified field when the content template is processed.

Dynamic content is inserted using merge tags. Refer to the merge tag user guides for more information.

This is the Post Content Templatesettings for the Post Body.

This is the Post Content Templatesettings for the Post Title.

Create a New Form

Create a New Form

IntroductionCreating a New Form

Introduction

This short article gives you a quick overview of the Form Editor, which is the primary environment for creating a form with Gravity Forms.

Creating a New Form

Log into your WordPress admin, and look for the Forms menu with the Gravity Forms 「G」 in the left hand navigation area.

Log into your WordPress admin, and look for the Forms menu with the Gravity Forms 「G」 in the left hand navigation area.

Under the Forms item you will see an option that says New Form. Clicking that will it to start the form creation process.

You will then be presented with a dialog box asking for the Title and Description of your new form.

You must give your form a name before you can begin, but you can change that name later if needed. The name is used so you can find your form easily later on.

Once you』ve filled out the field(s), finalize by clicking the Create Form button.

You will now be presented with a blank Form Editor screen, ready for your upcoming Form masterpiece!

Screenshot: The Gravity Forms Form Editor, as shown for a new form.

This article shows the new 「Block Editor」 we introduced in Gravity Forms version 2.5. If your Editor screen looks quite different, it means you are using an older version of Gravity Forms. The fields, settings, operations and terms are basically the same, but you will find that the layout will look quite different. We recommend you update to the most current version, it』s awesome!

Getting to know the Form Editor is covered in our next article.

next article: The Form Editor >

Coupons Feed Meta

Coupons Feed Meta

IntroductionUsageProperties

Introduction
The Feed Object meta for the Coupons add-on is an associative array containing the properties which determine the type of coupon and discount available.
$feed['meta'] = array(
'gravityForm' => 0,
'couponName' => 'test100',
'couponCode' => 'TEST100',
'couponAmountType' => 'percentage',
'couponAmount' => 100,
'startDate' => '',
'endDate' => '',
'usageLimit' => 20,
'isStackable' => false,
'usageCount' => 2,
);

Usage
We recommend accessing the $feed meta using the rgar() or rgars() functions, e.g.:
$couponCode = rgars( $feed, 'meta/couponCode' );

Properties

gravityForm string
The form ID this coupon was created for. An ID of 0 indicates the coupon can be used with ALL forms.

couponName string
The coupon name.

couponCode string
The the value users should enter to apply this coupon to the form total.

couponAmountType string
The coupon amount type. Possible values: flat or percentage.

couponAmount string
The coupon amount.

startDate string
The date when the coupon should start.

endDate string
The date when the coupon should expire.

usageLimit integer
The number of times the coupon can be used.

isStackable boolean
Can this coupon be used in conjunction with another coupon? Default is false.

usageCount integer
The number of times this coupon has been used since the count was last reset.

Coupons Change Log

Coupons Change Log

3.0 | 2020-09-292.11 | 2020-09-282.10 | 2020-05-112.9 | 2019-8-142.8 | 2018-11-302.7 | 2018-11-022.6 | 2017-04-262.5 | 2017-02-222.4 | 2017-01-052.3 | 2016-07-292.2 | 2015-07-272.1 | 2015-04-202.0 | 2015-03-301.1 | 2014-09-241.0 | 2014-07-15

3.0 | 2020-09-29

Added a custom icon to the Coupon field for Gravity Forms 2.5.
Updated empty coupons list verbiage.
Fixed the alignment of the coupon amount tooltip in the add new coupon page.
Fixed compatibility issues with PHP 8.

2.11 | 2020-09-28

Added support for Gravity Forms 2.5.
Fixed a rounding issue with the form total for some discounts when used with the PayPal Commerce Platform Add-On.
Fixed PHP notices which occur when exporting the coupon field value for entries created since version 2.9.3.

2.10 | 2020-05-11

Added translations for Hebrew, Hindi, Japanese, and Turkish.
Added support for dynamic population.
Added the label visibility and description placement settings to the field appearance tab.
Fixed a notice with PHP 7.4 which occurs when configuring a new coupon.
Fixed an issue where a coupon using an integer based code would prevent a product field with a matching ID from appearing in the order summary table.

2.9 | 2019-8-14

Added the gform_coupons_can_apply_coupon PHP filter enabling custom logic to be used to determine if the coupon code can be applied.
Added the gform_coupons_post_delete_coupon JS action hook which is triggered after a coupon is deleted from the field.
Fixed an issue which can result in negative values for total fields.
Fixed issue where conditional logic generates error if the input being evaluated does not have an ID attribute (e.g. List field inputs).

2.8 | 2018-11-30

Added support for GF 2.4 conditional logic.

2.7 | 2018-11-02

Added $entry as the fourth parameter of the gform_coupons_discount_amount filter.
Added GPL to plugin header.
Updated the Start Date and End Date datepickers on the edit coupon page to use the YYYY-MM-DD format.
Updated Plugin URI and Author URI to use https.
Fixed Euro currency formatting of the flat amount when the edit coupon page is displayed.

2.6 | 2017-04-26

Added security enhancement.
Added translations.
Fixed code style.

2.5 | 2017-02-22

Added security enhancement.
Added 'isCoupon' flag when adding coupons to order summary; allows 3rd parties to more reliable identify coupons in the order summary.

2.4 | 2017-01-05

Added gform_coupons_is_valid_code to override coupon code alphanumeric checking in Gravity Forms 2.2.2.
Updated coupons.js to use the gform_product_total filter with a later priority.
Updated how default label for new fields is set.
Fixed wrong domain for translating the "Coupon" button.
Fixed an issue with the formatting of the percentage coupon amount when a decimal comma based currency is in use.

2.3 | 2016-07-29

Added Dutch translation (nl_NL). Credit: Maarten Emmerink.
Updated gform_coupon_script dependencies to include gform_gravityforms.
Updated Coupon Code validation to only allow alphanumeric characters.
Updated bulk actions and feed action links.
Fixed issue where "undefined" was output before coupon markup when applying a coupon.
Fixed front-end JS error when attempting to remove an applied coupon if the coupon code includes special characters.

2.2 | 2015-07-27

Added GF_Field_Coupon::get_value_export() to return entry value formatted as {couponName} ({couponCode}: {discount}). Multiple codes will be comma separated e.g. $50 OFF (50OFF: -$50.00), 25% OFF (25OFF: -$10.00). Used for entry exports and some framework based add-ons since GF 1.9.12.4.
Added required and custom validation message settings.
Updated Spanish (es_ES) translation.
Updated minimum Gravity Forms version to 1.9.5.
Updated scripts and stylesheets to use minified files by default unless SCRIPT_DEBUG is active or query param gform_debug is set, e.g. domain.com/?gform_debug.
Updated to alert if a Total field is not present when adding the Coupon field.
Fixed an issue with one of the field validation messages not being translatable.
Fixed an issue with the coupons not being included in the product info when notifications are sent after submission.
Fixed an issue with duplicate coupon codes being allowed to be created.
Fixed an issue with the coupon field where removed coupons were not removed from the hidden coupon detail input resulting in the appearance that the coupon was reapplied when returning to the page containing the coupon field.
Fixed an issue with the upgrade routine which caused it run even if a pre-framework version hadn't been installed.

2.1 | 2015-04-20

Added Spanish (es_ES) translation.
Updated gform_coupon_script deps to include gform_json.
Fixed a low severity security vulnerability in the admin area which could be exploited by authenticated users with form administration permissions.

2.0 | 2015-03-30

Added Add-on Framework integration.
Added support for using the coupon field with conditional logic.
Added support for placeholders.
Added POT file.
Added a bulk action to the feed page for resetting the coupon usage count.
Added the visibility setting to the fields advanced tab.
Added the capability to view the plugin page.
Added text domain/path to header.
Added gform_coupons_discount_amount PHP hook to support modifying the discount amount.
add_filter( 'gform_coupons_discount_amount', 'add_logged_in_user_bonus_discount', 10, 3 );
function add_logged_in_user_bonus_discount( $discount, $coupon, $price ) {
if( is_user_logged_in() ) {
$discount += 5;
}
return $discount;
}
Added gform_coupons_discount_amount JS hook.
gform.addFilter( 'gform_coupons_discount_amount', function( discount, couponType, couponAmount, price, totalDiscount ) {
// you would need to write your own JS-version of is_user_logged_in()
if( is_user_logged_in() ) {
discount += 5;
}
return discount;
} );
Fixed an issue with the ajax request for applying coupons not functioning for logged out users.
Fixed an issue with feed processing which in some situations could prevent the coupon usage count being updated.
Fixed an issue with the field label for attribute.
Fixed an issue with the usage count being lost when updating an existing coupon.
Fixed an issue where pasting the coupon code using right-click caused the Apply button to not enable.
Fixed issue where existing coupon code was not saved when editing an entry.
Fixed issue with some translation text domain strings being misspelled.

1.1 | 2014-09-24

Updated plugin updated method so that it takes advantage of proxy manager to get around the blacklisted IP issue.
Updated several instances of domain used for translations from gravityformscoupon to the correct domain of gravityformscoupons.
Updated javascript in DisableApplyButton function since the button remained disabled for some users.
Fixed issue with product info cache not including coupon on certain situations.
Fixed issue with text domain of some strings.
Fixed another issue with duplicate coupon codes being allowed to be created.
Fixed issue with duplicate coupon codes being allowed to be created.
Fixed fatal error when plugin is activated without Gravity Forms active.
Fixed issue where existing coupon code was not saved when editing an entry.
Fixed issue with start and expiration date not taking the configured WP timezone into account.
Fixed issue where translations were not being applied on the front end.
Fixed issue with coupon not being applied when form failed validation.
Fixed issue with coupon being marked as "undefined" after a submission when clicking the back browser button.

1.0 | 2014-07-15

Fixed issue with applying fixed amount coupon code with currencies other than US dollar.
Fixed issue where changing an existing coupon from being form specific to 'any form' resulted in an 'Invalid coupon.' message on any form other than the original.

Constant Contact Change Log

Constant Contact Change Log

1.5 | 2020-09-161.4 | 2020-07-201.3 | 2020-03-161.2 | 2019-11-271.1 | 2019-08-061.0 | 2019-03-11

1.5 | 2020-09-16

Fixed a PHP fatal error which can occur during form submission if the contact exists request fails.

1.4 | 2020-07-20

Added security enhancements.
Added a mapping for mobile phone number on the feed settings page.
Added partner code.
Added support for Gravity Forms 2.5.

1.3 | 2020-03-16

Added translations for Hebrew, Hindi, Japanese, and Turkish.
Fixed an issue with the position in the Form Settings menu when multiple add-ons are installed.
Fixed a PHP 7.4 notice which occurs when the API is initializing and the access and refresh tokens are not available.
Fixed a PHP 7.4 notice which occurs when processing the feed for a new contact.

1.2 | 2019-11-27

Fixed an issue where submissions may fail to be sent to Constant Contact because of an authentication error.

1.1 | 2019-08-06

Fixed a PHP fatal error which could occur on the feed settings page if a WP_Error was returned when getting the custom fields.
Fixed a PHP error which could occur when using the http_request_timeout filter with WP 5.1+.

1.0 | 2019-03-11

It's all new!

Consent

Consent

SummaryCommon SettingsGeneral SettingsDetailsEntry ManagementForm RevisionsRelated Filters

Summary

The Consent field allows you to offer a 「yes/no」 consent checkbox and a detailed description of what is being consented to. It is available under the Advanced Fields section within the form editor.

Consent field as displayed in the Field Library

Consent field as displayed in the Form Editor.

When an entry is submitted, the consent field will record the status of the consent checkbox, and if it was checked (consent was provided), then the consent title and description (as presented at the time of submission) will also be recorded. See the Entry Management section below.

This field type was introduced in Gravity Forms 2.4.

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 description of specialty settings that are particular to this field.

General Settings

SettingDescriptionCheckbox LabelThis option allows you to specify the text the user will see next to the consent checkbox.

Details

HTML can be included in the consent description.The value of the consent description will not be displayed with the {all_fields} merge tag, but can be accessed by specifying the full input ID (i.e. {Consent:3.3}).

Entry Management

When processing an entry, the consent field will record the state of the consent checkbox (checked or not checked) . If the consent checkbox was checked, then the entry will also record the consent title and description, as was displayed at the time of form submission.

This allows you to modify the form and the details of consent, without affecting the historical record of exactly what previous submissions were agreeing to.

When displaying the entry detail, the entire consent description will be shown.

Form Revisions

Consent detail is recorded with an entry by storing the revision ID of the form that was consented to. This saves space in the entry table by reducing duplication. When displaying the entry detail though, Gravity Forms will show the entire consent description.

If you delete the form, all revision data is also deleted (along with all the entries, which is normal behavior).

Related Filters

The following filters were added to Gravity Forms in support of the consent field:

gform_consent_checked_indicatorgform_consent_checked_indicator_markup

Connecting to Stripe in Live or Test Mode

Connecting to Stripe in Live or Test Mode

IntroductionPre-RequisitesConnect to a Live Account Connect to a Test AccountScreenshots

Introduction

You have two Mode options when connecting Gravity Forms to your Stripe account: Test and Live.

The process to connect to either is very similar, but we have noticed some differences when connecting a test account and using the 「Skip This Form」 option. This document explains how to connect to either Mode.

Pre-Requisites

See this guide for all the pre-requisites.

Connect to a Live Account

If connected to the live Stripe environment, any transactions passed will attempt to generate real charges.

Navigate to your Forms → Settings → Stripe Settings, and look for the Stripe Account section.Set the Mode to LiveClick the 「Connect with Stripe」 button.You will be presented with the Stripe sign-in page. Complete the sign-in process.You should now see a Stripe account selection page (these accounts are created from within your Stripe service dashboard, see this guide). The email address of your Stripe account will be displayed at the top of the page. Select the account you wish to use to collect live payments and click the 「Connect」 button. You may be presented with various Stripe forms requesting additional business information if your account is not fully setup for live payment. Complete any information Stripe requires, and then authorize the account to confirm connection to your Gravity Forms. You will be returned to the Stripe Settings page. You should see 「Connected to Stripe as」 with your account name as well as a 「Disconnect」 button.

Connect to a Test Account

Connecting to a Test account allows you to have a sandbox for testing the passing and behavior of submissions between your form and Stripe, but will not generate real transactions.

Unlike when connecting to a live account, this time you will not 「Connect」, but will instead 「Skip This Form」. This avoids all the Stripe account and connected bank verification steps that would otherwise be requested, and are not necessary when doing test submissions. To skip this step, you must have two-factor authentication enabled in your Stripe account

Login to your Stripe account and navigate to your Profile screen (click the icon in the top right corner). Ensure that you have two factor authentication (2FA) enabled in your Settings. See this Stripe guide for assistance. Go back to your WordPress dashboard, and navigate to your Forms → Settings → Stripe Settings, and look for the Stripe Account section.Set the Mode to TestClick the 「Connect with Stripe」 button. You will get a 「redirecting you to Stripe」 screenIf you logged into Stripe at Step 1, you should now see a Stripe account selection page (these accounts are created from within your Stripe service dashboard, see this guide). If not, you will bet presented with the Stripe login dialog first.Once logged in, this screen shows the email address of your Stripe account, and the words Test Mode, will be displayed at the top of the page. From the list of Stripe accounts provided, choose the account you wish to connect to for testing.Click 「Skip this Form」 at the top of page (next to where it states 「You』re currently in test mode」).You should now be redirected back to your Gravity Forms settings page, and see the the Stripe Account panel now says 「Connected to Stripe Account…」 and the name of the account you chose in step 7 should be displayed.

If your Settings screen shows 「Unnamed account「, this most likely means you did not have 2FA properly set. This is a newly created anonymous account, but as it is not connected to your account, you will not be able to see any of the test transactions you run. Disconnect this newly created account, and follow the instructions above.

Screenshots

The Stripe login dialog, as presented at the start of the connection process.

The account selection screen will present multiple options if you have multiple Stripe accounts connected to your email. This screenshot shows a Test mode connection.

The Skip This Form button, as described above for Test Mode connections.

Once successfully connected, the Gravity Forms Stripe Settings page will display the connected account.