![Power Boost for Gravity Forms](assets/banner-1544x500.jpg)

# Power Boost for Gravity Forms

WordPress plugin. An add-on for Gravity Forms. Enhances Gravity Forms for power users.

Visit this plugin's home page: [breakfastco.xyz/power-boost-for-gravity-forms](https://breakfastco.xyz/power-boost-for-gravity-forms/)

## FEATURES

### Adds a "Last Entry" column to the forms list.

Indicates which forms are truly active   ![screenshot-1](assets/screenshot-1.png)

### Adds a tab "Replace Forms" to the Import/Export page

Updates existing forms instead of creating duplicates

   ![screenshot-6](assets/screenshot-6.png)

### Adds a "Resend Feeds" button near the Resend Notifications button

![screenshot-4](assets/screenshot-4.png)

### Saves .json file exports of each form when forms are edited

Saved in `wp-content/uploads/gf-json/`. Override this path with the `gravityforms_local_json_save_path` hook.

   ![screenshot-2](assets/screenshot-2.png)

### Adds field IDs near labels when viewing or editing an entry in the dashboard

   ![screenshot-3](assets/screenshot-3.png)

### Adds field IDs near labels when editing forms

Thanks be to Dario Nem for suggesting this snippet from the Gravity Wiz toolbox.

![screenshot-3](assets/screenshot-7.png)

### Adds a "Copy Shortcode" row action link to the forms list

![screenshot-5](assets/screenshot-5.png)

### Enables merge tags in HTML fields

Requires page breaks. Merge tags display user input from previous pages in HTML fields.

Enables merge tags in HTML fields. The merge tag must be on a page after the field. If your field, “What kind of pet do you have?” is on page one of the form, the HTML field containing the merge tag `{What kind of pet do you have?:1}` should be on page two or any page after one.

![screenshot-8](assets/screenshot-8.png)

### Caches the Dashboard Widget

Replaces the Gravity Forms dashboard widget with a copy that caches the results of the three database queries. These queries can take a handful of seconds to run on sites with hundreds of forms and tens of thousands of entries.

![screenshot-9](assets/screenshot-9.png)

## FILTER HOOKS

### Change the Local JSON Path

`gravityforms_local_json_save_path`

The absolute file path to a directory where the form export .json files are saved. Defaults to `wp-content/uploads/gf-json`

#### Example

Changes the path to save .json files to one level above the directory containing WordPress.

```
<?php
add_filter( 'gravityforms_local_json_save_path', 'power_boost_change_json_path' );
/**
 * Changes the path to save .json files to one level above the directory containing WordPress.
 *
 * @return string
 */
function power_boost_change_json_path() {
	return dirname( ABSPATH );
}

```

&nbsp;

### Edit Form Before it's Saved as JSON

`gravityforms_local_json_save_form`

Allows a forms array containing a single form to be edited just before it is written to the .json file

&nbsp;

### Toggle JSON Pretty Print

`gravityforms_local_json_minimize`

Controls whether the form JSON is encoded with the `JSON_PRETTY_PRINT` flag. Defaults to `false`

&nbsp;

### Change Dashboard Widget Cache Time

`gravityforms_dashboard_cache_duration`

The number of seconds to cache the Gravity Forms dashboard widget database queries. Defaults to `6 * HOUR_IN_SECONDS`

&nbsp;

### Control Which Add-ons Export Feeds

`gfpb_local_json_addons_that_export_feeds`

An array of add-on slugs whose feeds are included in form JSON exports and should therefore be deleted before a form is re-imported to prevent duplication. Used by both the Local JSON and Replace Forms features. Defaults to `['gravityflow', 'gravityformsadvancedpostcreation']`.

#### Example

Removes GravityFlow from the list so its feeds are left in place and never deleted during imports.

```php
<?php
add_filter( 'gfpb_local_json_addons_that_export_feeds', 'my_gfpb_addons_that_export_feeds' );
/**
 * Removes GravityFlow from the list of add-ons whose feeds are deleted
 * before a form is updated from a JSON file.
 *
 * @param  array $slugs Add-on slugs.
 * @return array
 */
function my_gfpb_addons_that_export_feeds( $slugs ) {
	return array_diff( $slugs, array( 'gravityflow' ) );
}
```

&nbsp;

### Control Whether a Feed is Deleted During Import

`gfpb_local_json_should_delete_feed`

Controls whether an individual feed is deleted before its form is updated from a JSON file. Return `true` to delete the feed (so the version from the JSON file is used), or `false` to keep it. Used by both the Local JSON and Replace Forms features.

| Parameter | Type | Description |
|---|---|---|
| `$should_delete` | `bool` | Whether the feed will be deleted. |
| `$feed` | `array` | The feed data. |
| `$form` | `array` | The form being updated. |

#### Example

Prevents GravityFlow feeds from being deleted for one specific form, leaving that form's GravityFlow configuration untouched during imports.

```php
<?php
add_filter( 'gfpb_local_json_should_delete_feed', 'my_gfpb_should_delete_feed', 10, 3 );
/**
 * Prevents GravityFlow feeds from being deleted when a specific form is
 * updated from a JSON file.
 *
 * @param  bool  $should_delete Whether the feed will be deleted.
 * @param  array $feed          Feed data.
 * @param  array $form          Form data.
 * @return bool
 */
function my_gfpb_should_delete_feed( $should_delete, $feed, $form ) {
	$protected_form_id = 5;
	if ( isset( $form['id'], $feed['addon_slug'] )
		&& $protected_form_id === (int) $form['id']
		&& 'gravityflow' === $feed['addon_slug']
	) {
		return false;
	}
	return $should_delete;
}
```

&nbsp;

## MORE PLUGINS

 - [Coral Bridge](https://breakfastco.xyz/coralbridge) connects Gravity Forms and HubSpot CRM
 - [Embed PDF for Gravity Forms](https://wordpress.org/plugins/embed-pdf-gravityforms/)
