Git Product home page Git Product logo

gravityformscli's Introduction

Gravity Forms CLI Add-On

The Gravity Forms CLI Add-On allows WP-CLI users to manage installation, forms and entries on the command line.

Documentation

Getting started

  • wp help gf
  • wp help gf form
  • wp help gf field
  • wp help gf entry
  • wp gf license
  • wp help gf tool

Form Management

wp gf form [command]

Commands:

  • create - Creates a new form.
  • delete - Deletes a form.
  • duplicate - Duplicates a form.
  • edit - Launch system editor to edit the Form configuration.
  • export - Exports forms to a Gravity Forms Form export file.
  • list - Lists the forms with entry count and view counts.
  • get - Returns the form JSON.
  • import - Imports forms from a Gravity Forms Form export file.
  • update - Updates a form.

Field Management

  • wp gf form field [command]
  • wp gf field [command] (alias)

Commands:

  • create - Creates a field and adds it to a form.
  • delete - Deletes a field.
  • duplicate - Duplicates a field.
  • edit - Launch system editor to edit the Field configuration.
  • get - Returns the JSON representation of a field.
  • list - Displays a list of fields for a form.
  • update - Updates a field.

Notification Management

  • wp gf form notification [command]
  • wp gf notification [command] (alias)

Commands:

  • create - Creates a new notification.
  • delete - Deletes a notification.
  • duplicate - Duplicates a notification.
  • edit - Launch system editor to edit the notification configuration.
  • list - Lists the notification.
  • get - Returns the notification JSON.
  • update - Updates a notification.

Entry Management

wp gf entry [command]

Commands:

  • create - Creates a new entry from either a JSON string with the raw entry or from field-value pairs.
  • delete - Deletes an entry.
  • duplicate - Duplicates an entry
  • edit - Launch system editor to edit the JSON representation of the Entry.
  • export - Exports entries.
  • get - Returns a JSON representation of an entry.
  • import - Imports entries.
  • list - Displays a list of entries.
  • update - Updates an entry.

Entry Notifications

wp gf entry notification [command]

Commands:

  • get - Returns the notifications for the given entry.
  • send - Sends the notifications for the given entry.

License Management

wp gf license [command]

Commands:

  • update - Updates the license key for the installation.
  • delete - Deletes the license key for the installation.

Misc Tools

wp gf tool [command]

Commands:

  • clear_transients
  • empty-trash Delete the trashed entries.
  • verify-checksums Verify Gravity Forms files against the checksums.
  • system-report Outputs the system report from the Forms > System Status page. Supports "status" as an alias.

Installing and Updating Gravity Forms and Add-Ons

The above commands all require Gravity Forms to be installed. However, if Gravity Forms is not installed then you can use this add-on to install it along with all the other official Gravity Forms add-ons.

The install command will download and install the latest version Gravity Forms and then run the database setup. The license key will be saved in the plugin settings.

A valid license key is required either in the GF_LICENSE_KEY constant or the --key option.

Examples:

  • wp gf install --key=xxxxx
  • wp gf install --key=xxxxx --activate
  • wp gf install gravityformspolls --key=xxxxx
  • wp gf install gravityformsquiz --key=xxxxx

Once installed, the database can be set up or upgraded separately using the setup command. The command will not re-run the setup unless the --force flag is set.

Examples:

  • wp gf setup
  • wp gf setup --force

Gravity Forms and add-ons can be updated using the update command.

Examples:

  • wp gf update
  • wp gf update gravityformspolls

Check the current version using the version command.

Examples:

  • wp gf version
  • wp gf version gravityformspolls

Requirements

  1. Wordpress 4.2+
  2. Gravity Forms > 1.9.17.8
  3. WP-CLI v1.0+

Support

If you find anything that needs fixing please open a support ticket at https://www.gravityforms.com/open-support-ticket/

If you have any ideas for improvements please submit your idea at https://www.gravityforms.com/gravity-forms-roadmap/

gravityformscli's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gravityformscli's Issues

Bug - "wp gf license update" command fails

Hi there,

When using the wp gf license update <license-code> command on a fresh WordPress installation with Gravity Forms and Gravity Forms CLI the following happens:

  • The notification about having to enter a license is gone
  • Every Gravity Forms admin page still redirects to the /wp-admin/admin.php?page=gf_settings page where you have to enter the license key.

Any idea's on how to fix this or alternative ways to programatically set the Gravity Forms license key?

trigger email notifications upon entry creation?

It totally makes sense to skip notifications by default. It'd be great to have the ability to do so sometimes.

Perhaps a new argument could be added to entry creation that would allow triggering the email notifications setup for a form?

i.e. wp gf entry create <fields/values> --notify

or something similar.

Availability on Packagist

Since this is now functional as a WP-CLI package, and declares itself as such in its composer.json, I'd love to see this available via Packagist as well. If it's being consumed via WPackagist, it has to be as a plugin rather than a WP-CLI package.

cURL error when trying to install the plugin

When I try to do:

wp gf install --key=[my_key]--activate

I get the following error:

Error: cURL error 35: Unknown SSL protocol error in connection to www.gravityhelp.com:443

Here is my php version in case this can help:

PHP 5.6.10 (cli) (built: Jul  6 2015 14:28:54)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

And for which php

/Applications/MAMP/bin/php/php5.6.10/bin/php

Ability to use as standalone WP-CLI Package

This is the same request as I made a few years ago in #1, which at the time was closed because the official wp-cli "package index" wasn't accepting new submissions. Since then, they have decided to no longer maintain this separate index, and instead simply use any composer source, such as packagist, or a git repo directly.

I've taken a few minutes to see what changes are needed, and it breaks down like this:

  1. Any check for defined( 'ABSPATH' ) needs to be removed, or changed to check for defined( 'WP_CLI' ) as an alternative
  2. add_action isn't available in the wp-cli bootstrap process, so GF_CLI_Bootstrap::load_cli() should be called unconditionally
  3. For the same reason, GF_CLI_Bootstrap::load_addon() needs to be loaded differently or conditionally
  4. Similarly, plugin_dir_path() isn't available during bootstrap, but is easily replaced with dirname() (and rtrim() to be really clean)

With these changes made, I can use the plugin as a global wp-cli package without any further issues. The only other small niggle is that the type in the composer.json file isn't wp-cli-package as recommended, but this isn't a strict requirement.

"Class 'GFCommon' not found" when attempting to install plugins from cli plugin

Hello! Right now I am experiencing the following when trying to install gravityforms via cli script:

$ wp plugin delete gravityforms
Warning: The 'gravityforms' plugin could not be found.
Success: Plugin already deleted.
$ wp plugin delete gravityformscli
Deleted 'gravityformscli' plugin.
Success: Deleted 1 of 1 plugins.
$ wp plugin install gravityformscli --activate
Installing Gravity Forms CLI Add-On (1.0-beta-5)
Downloading install package from https://downloads.wordpress.org/plugin/gravityformscli.zip...
Using cached file '/Users/ernie/.wp-cli/cache/plugin/gravityformscli-1.0-beta-5.zip'...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Activating 'gravityformscli'...
Warning: Plugin 'gravityformscli' is already active.
Success: Installed 1 of 1 plugins.
$ wp gf install --key=[OURLICENSEKEY] --activate
Fatal error: Class 'GFCommon' not found in /Users/ernie/Sites/vagrant-local/www/wbu/public_html/wp-content/plugins/gravityformscli/includes/class-gf-cli-root.php on line 103

I am experiencing this both locally and when I run a similar version of this on our travis build, where we get the additional stack trace issue:

Stack trace:
#0 [internal function]: GF_CLI_Root->install(Array, Array)
#1 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Dispatcher/CommandFactory.php(81): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Dispatcher/Subcommand.php(401): call_user_func(Object(Closure), Array, Array)
#4 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Runner.php(323): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Runner.php(330): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Runner. in /home/travis/build/wherebyus/wbu-referrals/tmp/wp-content/plugins/gravityformscli/includes/class-gf-cli-root.php on line 103
Fatal error: Uncaught Error: Class 'GFCommon' not found in /home/travis/build/wherebyus/wbu-referrals/tmp/wp-content/plugins/gravityformscli/includes/class-gf-cli-root.php:103
Stack trace:
#0 [internal function]: GF_CLI_Root->install(Array, Array)
#1 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Dispatcher/CommandFactory.php(81): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Dispatcher/Subcommand.php(401): call_user_func(Object(Closure), Array, Array)
#4 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Runner.php(323): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Runner.php(330): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///home/travis/build/wherebyus/wbu-referrals/tmp/wp-cli.phar/php/WP_CLI/Runner. in /home/travis/build/wherebyus/wbu-referrals/tmp/wp-content/plugins/gravityformscli/includes/class-gf-cli-root.php on line 103
Error: Gravity Forms is not installed. Use the "wp gf install" command to install Gravity Forms.

Any help would be appreciated, as I'm not sure what to do next. Thanks so much!

After upgrade to version 1.0-beta-5 I cant install gravity forms

Hello,

After upgrade to version 1.0-beta-5 I cant install gravityforms plugin with this command:
wp gf install I have my key with GF_LICENSE_KEY constant.

This is the error I'm getting:

PHP Fatal error:  Uncaught Error: Class 'GFCommon' not found in path/to/plugins/gravityformscli/includes/class-gf-cli-root.php:103
Stack trace:
#0 [internal function]: GF_CLI_Root->install(Array, Array)
#1 phar:///usr/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php(67): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///usr/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php(401): call_user_func(Object(Closure), Array, Array)
#4 phar:///usr/bin/wp/php/WP_CLI/Runner.php(323): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///usr/bin/wp/php/WP_CLI/Runner.php(330): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///usr/bin/wp/php/WP_CLI/Runner.php(929): WP_CLI\Runner->_run_command()
#7 phar:///usr/bin/wp/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#8 phar:///usr/bin/wp/php/bootstrap.php(75): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapStat in /path/to/plugins/gravityformscli/includes/class-gf-cli-root.php on line 103
Fatal error: Uncaught Error: Class 'GFCommon' not found in /path/to/plugins/gravityformscli/includes/class-gf-cli-root.php:103
Stack trace:
#0 [internal function]: GF_CLI_Root->install(Array, Array)
#1 phar:///usr/bin/wp/php/WP_CLI/Dispatcher/CommandFactory.php(67): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///usr/bin/wp/php/WP_CLI/Dispatcher/Subcommand.php(401): call_user_func(Object(Closure), Array, Array)
#4 phar:///usr/bin/wp/php/WP_CLI/Runner.php(323): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///usr/bin/wp/php/WP_CLI/Runner.php(330): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///usr/bin/wp/php/WP_CLI/Runner.php(929): WP_CLI\Runner->_run_command()
#7 phar:///usr/bin/wp/php/WP_CLI/Bootstrap/LaunchRunner.php(23): WP_CLI\Runner->start()
#8 phar:///usr/bin/wp/php/bootstrap.php(75): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapStat in /path/to/plugins/gravityformscli/includes/class-gf-cli-root.php on line 103

Bug in gravityforms.js @ function setFieldAccessibility() Solution snippet provided

Here is the fix, for some reason it was passing a string for the element id, where the code assumes an element.

  /**
	     * @function setFieldAccessibility
	     * @description Patches accessibility issues with the plupload multi file container.
	     *
	     * @since 2.5.1
	     *
	     * @param {Node} container The generated plupload container.
	     */

	    function setFieldAccessibility( container ) {
            if ( typeof container === "string" ){
                container = document.getElementById(container);
            }
            var fileInputs = container.querySelectorAll( 'input[type="file"]' );
            var gformButtonSelectFiles = container.querySelectorAll( '.gform_button_select_files' );

            var input = fileInputs.length > 0 ? fileInputs[ 0 ] : false;
            var button = gformButtonSelectFiles.length > 0 ? gformButtonSelectFiles[ 0 ] : false;
		    var label = $( uploadElement ).closest( '.gfield' ).find( '.gfield_label' )[ 0 ];

		    if ( ! input || ! label || ! button ) {
			    return;
		    }

		    label.setAttribute( 'for', input.id );
		    button.setAttribute( 'aria-label', button.innerText.toLowerCase() + ', ' + label.innerText.toLowerCase() );
		    input.setAttribute( 'tabindex', '-1' );
		    input.setAttribute( 'aria-hidden', 'true' );
	    }

Licence Update command not registering gravity forms

Seems to be something odd going on with the wp gf licence update xxx command.

When I run it from the command line, it says that it runs successfully but when I go to the forms area in WP it brings up the enter license key screen.

Though on the plugins page, it doesnt show the message below anymore.

Register your copy of Gravity Forms to receive access to automatic upgrades and support. Need a license key? Purchase one now.

If I run wp gf license delete that message shows up again on the plugins page.

Other notes, when running wp gf tools system-report, the registration data always shows Registration: Not Registered โŒ

I've also tried running the wp gf setup --force after install with the key and it still doesnt work.

Where there updates to the gf plugin registration that are not reflected in this cli plugin tool?

WP-CLI Package

Any plans to make this compatible as a WP-CLI package so that this can be installed globally in a shared hosting environment? It should hopefully just involve generating a composer.json file for the project, and a quick rework of the logic for loading the WP-CLI commands.

Creating a form from a JSON results in a broken form if no field IDs specified

The following command results in a successful form addition but when editing the form fields in the WP admin, the fields' details don't expand.

WP-CLI command: wp gf form create --form-json='FORM_JSON_GOES_HERE'

When trying to expand a field in the admin panel the following error is printed to the console:

TypeError: form.fields[b] is null

This is due to the inputs in my JSON not including field IDs.

Example field in my JSON (this doesn't work):

{
    "type": "text",
    "label": "Name",
    "defaultValue": "",
    "visibility": "visible",
    "isRequired": true,
    "size": "large"
},

When I add IDs manually to the import, the form functions correctly:

{
    "type": "text",
    "label": "Name",
    "defaultValue": "",
    "visibility": "visible",
    "isRequired": true,
    "size": "large",
    "id": 1
},

Requested change

Would it be possible to auto-assign consecutive field IDs on import?

Environment

WP Version: 4.9.8
GF Version: 2.3.4.3
GF-CLI Version: 1.0

Install without database

I would like to be able to use the CLI to install Gravityforms as part of my CI build process.

I can install the wp CLI, and install gravityformscli as an mu-plugin which but when I try to install with wp gf install -- --key I get Error: Error establishing a database connection.

The build is detailed in a Dockerfile and there is no database available at build time. The build takes place on an external runner.

As far as I can see, the CLI shouldn't need to access the DB in order to install the plugin, as it is just downloading and copying files to the plugin folder.

Is there some way to bypass the DB connection check?

Alternatively, is there some other way to install GF as part of a build process, e.g. via composer? I would like one which does not require me to lock to a specific version.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.