Skip to content

csalzano/power-boost-for-gravity-forms

Repository files navigation

Power Boost for Gravity Forms

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

FEATURES

Adds a "Last Entry" column to the forms list.

Indicates which forms are truly active screenshot-1

Adds a tab "Replace Forms" to the Import/Export page

Updates existing forms instead of creating duplicates

screenshot-6

Adds a "Resend Feeds" button near the Resend Notifications button

screenshot-4

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

Adds field IDs near labels when viewing or editing an entry in the dashboard

screenshot-3

Adds field IDs near labels when editing forms

Thanks be to Dario Nem for suggesting this snippet from the Gravity Wiz toolbox.

screenshot-3

Adds a "Copy Shortcode" row action link to the forms list

screenshot-5

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

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

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 );
}

 

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

 

Toggle JSON Pretty Print

gravityforms_local_json_minimize

Controls whether the form JSON is encoded with the JSON_PRETTY_PRINT flag. Defaults to false

 

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

 

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
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' ) );
}

 

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
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;
}

 

MORE PLUGINS

About

Enhances the dashboard for Gravity Forms power users. Nine features I can't live without.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages