Gravity Forms (WordPress-plugin): verschil tussen versies

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
 
(30 tussenliggende versies door dezelfde gebruiker niet weergegeven)
Regel 3: Regel 3:
 
Dit artikel gaat tot op heden (okt. 2021) vrijwel uitsluitend over de WP-CLI-commando's om Gravity Forms en bijbehorende formulieren te beheren.
 
Dit artikel gaat tot op heden (okt. 2021) vrijwel uitsluitend over de WP-CLI-commando's om Gravity Forms en bijbehorende formulieren te beheren.
  
== Installatie WP-CLI-add-on ==
+
== Licensering ==
  
Standaard ondersteunt Gravity Forms niet de WordPress Command Line Interface. Daar bestaat een gratis add-on voor. Die moet je apart installeren:
+
Het is een betaalde plugin. Zonder licentie doet-ie nix.
  
<pre>
+
* Als ik sites kloon, is de gekloonde licentie ok - Itt. tot een andere plugin (naam vergeten) waarbij de licentie URL-afhankelijk was
wp plugin install gravityformscli --activate
+
* Als ik alleen de plugin kopiëer en plak, is de licentie niet ok.
  
Installing Gravity Forms CLI Add-On (1.4)
+
== WP-CLI ==
Downloading installation package from https://downloads.wordpress.org/plugin/gravityformscli.1.4.zip...
 
Unpacking the package...
 
Installing the plugin...
 
Plugin installed successfully.
 
Activating 'gravityformscli'...
 
Plugin 'gravityformscli' activated.
 
Success: Installed 1 of 1 plugins.
 
</pre>
 
  
Activeren:
+
=== Installation ===
  
<code>
+
''Gravity Forms'' has quite a library of ''WP-CLI'' commands, but these need to be separately installed as a plugin:
wp plugin install gravityformscli --activate
 
</code>
 
 
 
== wp gf ==
 
  
 
<pre>
 
<pre>
$ wp help gf
+
wp plugin install gravityformscli --activate
 
 
NAME
 
 
 
  wp gf
 
 
 
DESCRIPTION
 
 
 
  Manage Gravity Forms.
 
 
 
SYNOPSIS
 
 
 
  wp gf <command>
 
 
 
SUBCOMMANDS
 
 
 
  check_update      Checks for available updates for Gravity Forms or a Gravity Forms official add-on.
 
  entry            Manage Gravity Forms Entries.
 
  field            Manage Gravity Forms Form Fields.
 
  form              Manage Gravity Forms.
 
  install           Installs Gravity Forms or a Gravity Forms official add-on.
 
  license          Manage the Gravity Forms License Key.
 
  notification      Manage Gravity Forms Notifications.
 
  setup            Runs the setup for Gravity Forms or a Gravity Forms official add-on.
 
  tool              Misc Gravity Forms Tools.
 
  update            Updates Gravity Forms or a Gravity Forms official add-on.
 
  version          Returns the version of Gravity Forms.
 
</pre>
 
 
 
=== wp gf check_update ===
 
 
 
=== wp gf entry ===
 
 
 
<pre>
 
$ wp help gf entry
 
 
 
NAME
 
 
 
  wp gf entry
 
 
 
DESCRIPTION
 
 
 
  Manage Gravity Forms Entries.
 
 
 
SYNOPSIS
 
 
 
  wp gf entry <command>
 
 
 
SUBCOMMANDS
 
 
 
  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.
 
  notification      Send Gravity Forms Notifications.
 
  update            Updates an entry.
 
</pre>
 
 
 
=== wp gf entry delete ===
 
 
 
<pre>
 
$ wp help gf entry delete
 
 
 
NAME
 
 
 
  wp gf entry delete
 
 
 
DESCRIPTION
 
 
 
  Deletes an entry.
 
 
 
SYNOPSIS
 
 
 
  wp gf entry delete <entry-id>... [--force]
 
 
 
</pre>
 
 
 
Met de Boolean optie <code>--force</code> worden entries direct verwijderd, ipv. verplaatst te worden naar de prullenbak.
 
 
 
Voorbeelden:
 
 
 
<pre>
 
# Delete a form entry
 
########################################
 
#
 
# Delete - Don't move it to trash
 
#
 
wp gf entry list 1 --format="ids"
 
 
 
1921 1920 1918 1909 1903 1898 1897 1896 1893 1889 1885 1884 1883 1882 1877 1876 1875 1867 1866 1863^C
 
 
 
$ wp gf entry delete --force 1921
 
 
 
Success: Deleted entry 1921
 
 
 
 
 
# Trying out wildcard * to delete all
 
########################################
 
#
 
# Some unexpected behaviour:
 
#
 
wp gf entry delete *
 
 
 
 
 
Error: Entry with id dvb not found
 
Error: Entry with id favicon.ico not found
 
Error: Entry with id help.txt not found
 
Error: Entry with id index.php not found
 
Error: Entry with id license.txt not found
 
Error: Entry with id list.txt not found
 
Error: Entry with id login.txt not found
 
Error: Entry with id malcare-waf.php not found
 
Error: Entry with id order-ids.txt not found
 
Error: Entry with id order_list.txt not found
 
Error: Entry with id readme.html not found
 
Error: Entry with id robots.txt not found
 
Error: Entry with id text2.txt not found
 
Error: Entry with id text.txt not found
 
Error: Entry with id wp not found
 
Error: Entry with id wp-activate.php not found
 
Error: Entry with id wp-admin not found
 
Error: Entry with id wp-blog-header.php not found
 
Error: Entry with id wp-comments-post.php not found
 
Error: Entry with id wp-config.php not found
 
Error: Entry with id wp-config-sample.php not found
 
Error: Entry with id wp-content not found
 
Error: Entry with id wp-cron.php not found
 
Error: Entry with id wp-includes not found
 
Error: Entry with id wp-links-opml.php not found
 
Error: Entry with id wp-load.php not found
 
Error: Entry with id wp-login.php not found
 
Error: Entry with id wp-mail.php not found
 
Error: Entry with id wp-salt.php not found
 
Error: Entry with id wp-settings.php not found
 
Error: Entry with id wp-signup.php not found
 
Error: Entry with id wp-trackback.php not found
 
Error: Entry with id xargs not found
 
Error: Entry with id xmlrpc.php not found
 
 
 
 
 
# "--all" to delete all? Nope
 
########################################
 
#
 
wp gf entry delete --all
 
 
 
usage: wp gf entry delete <entry-id>... [--force]
 
 
 
 
 
# No argument to delete all? Nope
 
########################################
 
#
 
wp gf entry delete
 
 
 
usage: wp gf entry delete <entry-id>... [--force]
 
 
 
 
 
# Delete all entries form 1-3
 
########################################
 
#
 
wp gf entry delete --force $(wp gf entry list 1 --format="ids" --page_size=100000)
 
wp gf entry delete --force $(wp gf entry list 2 --format="ids" --page_size=100000)
 
wp gf entry delete --force $(wp gf entry list 3 --format="ids" --page_size=100000)
 
</pre>
 
 
 
=== wp gf entry list ===
 
 
 
<pre>
 
$ wp help gf entry list
 
 
 
NAME
 
 
 
  wp gf entry list
 
 
 
DESCRIPTION
 
 
 
  Displays a list of entries.
 
 
 
SYNOPSIS
 
 
 
  wp gf entry list <form-id> [--status=<status>] [--format=<format>] [--page_size=<page_size>] [--offset=<offset>]
 
</pre>
 
 
 
'''--format'''
 
 
 
Mogelijke waardes:
 
 
 
* <code>table</code>
 
* <code>csv</code>
 
* <code>json</code>
 
* <code>count</code>
 
* <code>ids</code> - Deze optie vind je niet snel terug in de documentatie.
 
 
 
'''-page_size'''
 
 
 
Standaard worden er 20 entries weergegeven. Met de parameter <code>--page_size</code> kun je dit aanpassen. Ik heb dit getest op formulieren met bijna 900 entries, en dat ging prima. Er lijkt vooralsnog geen bovengrens te zijn.
 
 
 
Voorbeelden:
 
 
 
<pre>
 
# Returns number of entries for form 1
 
########################################
 
#
 
wp gf entry list 1 --format="count"
 
 
 
 
 
# Return first 20 entry id's form 1
 
########################################
 
#
 
# The option --format="ids" is hardly mentioned on their help page https://docs.gravityforms.com/managing-entries
 
# and completely not on the inline help, eventhough it's crucial for me to automatically delete entries
 
#
 
wp gf entry list 1 --format="ids"
 
 
 
 
 
# Return all entry id's form 1
 
########################################
 
#
 
wp gf entry list 1 --format="ids" --page_size=100000
 
</pre>
 
 
 
=== wp gf field ===
 
 
 
<pre>
 
$ wp help gf field
 
 
 
NAME
 
 
 
  wp gf field
 
 
 
DESCRIPTION
 
 
 
  Manage Gravity Forms Form Fields.
 
 
 
SYNOPSIS
 
 
 
  wp gf field <command>
 
 
 
SUBCOMMANDS
 
 
 
  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.  If it doesn't exist, creates it.
 
</pre>
 
 
 
=== wp gf field create ===
 
=== wp gf field delete ===
 
=== wp gf field duplicate ===
 
=== wp gf field edit ===
 
=== wp gf field get ===
 
 
 
<pre>
 
$ wp help gf field get
 
 
 
NAME
 
 
 
  wp gf field get
 
 
 
DESCRIPTION
 
 
 
  Returns the JSON representation of a field.
 
 
 
SYNOPSIS
 
 
 
  wp gf field get <form-id> <field-id>
 
</pre>
 
 
 
''' Voorbeeld '''
 
 
 
<pre>
 
$ wp gf field list 2
 
 
 
+----+------------+-------------------------+
 
| id | type      | label                  |
 
+----+------------+-------------------------+
 
| 2  | text      | Name                    |
 
| 5  | email      | E-mailadres            |
 
| 16 | text      | Telefoonnummer          |
 
| 11 | textarea  | Vraag of opmerking      |
 
+----+------------+-------------------------+
 
 
 
$ wp gf field get 2 2
 
 
 
{"type":"text","id":2,"label":"Name","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":2,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputMaskIsCustom":false,"maxLength":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"field-33 field-left","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","enablePasswordInput":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"pageNumber":1,"fields":"","displayOnly":""}
 
</pre>
 
 
 
=== wp gf field list ===
 
 
 
Verkrijg een lijst van velden voor een gegeven formulier. Enkel ID, type & label lijken te worden getoond, terwijl er vaak meer attributen zullen zijn.
 
 
 
<pre>
 
$ wp help gf field list
 
 
 
NAME
 
 
 
  wp gf field list
 
 
 
DESCRIPTION
 
 
 
  Displays a list of fields for a form.
 
 
 
SYNOPSIS
 
 
 
  wp gf field list <form-id> [--format=<output-format>]
 
</pre>
 
 
 
''' Voorbeeld '''
 
 
 
<pre>
 
$ wp gf field list 2
 
 
 
+----+------------+-------------------------+
 
| id | type      | label                  |
 
+----+------------+-------------------------+
 
| 2  | text      | Naam                    |
 
| 5  | email      | E-mailadres            |
 
| 16 | text      | Telefoonnummer          |
 
| 11 | textarea  | Vraag of opmerking      |
 
| 22 | fileupload | Foto                    |
 
| 15 | html      | HTML-blok              |
 
+----+------------+-------------------------+
 
</pre>
 
 
 
=== wp gf field update ===
 
 
 
<pre>
 
$ wp help gf field update
 
 
 
NAME
 
 
 
  wp gf field update
 
 
 
DESCRIPTION
 
 
 
  Updates a field.  If it doesn't exist, creates it.
 
 
 
SYNOPSIS
 
 
 
  wp gf field update <form-id> <field-id> [--<field>=<value>] [--field-json=<field-json>]
 
</pre>
 
 
 
''' Voorbeeld (1) '''
 
 
 
<pre>
 
$ wp gf field list 2 # See fields of form with ID=2
 
 
 
+----+------------+-------------------------+
 
| id | type      | label                  |
 
+----+------------+-------------------------+
 
| 2  | text      | Naam                    |
 
| 5  | email      | E-mailadres            |
 
| 16 | text      | Telefoonnummer          |
 
| 11 | textarea  | Vraag of opmerking      |
 
+----+------------+-------------------------+
 
 
 
 
 
$ wp gf field update 2 2 --label="Name"
 
 
 
Success: Field ID: 2 updated
 
 
 
 
 
$ wp gf field list 2
 
 
 
+----+------------+-------------------------+
 
| id | type      | label                  |
 
+----+------------+-------------------------+
 
| 2  | text      | Name                    |
 
| 5  | email      | E-mailadres            |
 
| 16 | text      | Telefoonnummer          |
 
| 11 | textarea  | Vraag of opmerking      |
 
+----+------------+-------------------------+
 
</pre>
 
 
 
''' Voorbeeld (2) '''
 
 
 
<pre>
 
$ wp gf field list 2
 
 
 
+----+------------+-------------------------+
 
| id | type      | label                  |
 
+----+------------+-------------------------+
 
| 2  | text      | Name                    |
 
| 5  | email      | E-mailadres            |
 
| 16 | text      | Telefoonnummer          |
 
| 11 | textarea  | Vraag of opmerking      |
 
+----+------------+-------------------------+
 
 
 
$ wp gf field get 2 2  # Layout reply door mij aangepast!
 
 
 
{
 
        "type":"text",
 
"id":2,
 
"label":"Name",
 
"adminLabel":"",
 
"isRequired":false,
 
"size":"medium",
 
"errorMessage":"",
 
"visibility":"visible",
 
"inputs":null,
 
"formId":2,
 
"description":"",
 
"allowsPrepopulate":false,
 
"inputMask":false,
 
"inputMaskValue":"",
 
"inputMaskIsCustom":false,
 
"maxLength":"",
 
"inputType":"",
 
"labelPlacement":"",
 
"descriptionPlacement":"",
 
"subLabelPlacement":"",
 
"placeholder":"",
 
"cssClass":"field-33 field-left",
 
"inputName":"",
 
"noDuplicates":false,
 
"defaultValue":"",
 
"choices":"",
 
"conditionalLogic":"",
 
"productField":"",
 
"enablePasswordInput":"",
 
"multipleFiles":false,
 
"maxFiles":"",
 
"calculationFormula":"",
 
"calculationRounding":"",
 
"enableCalculation":"",
 
"disableQuantity":false,
 
"displayAllCategories":false,
 
"useRichTextEditor":false,
 
"pageNumber":1,
 
"fields":"",
 
"displayOnly":""
 
}
 
 
 
$ wp gf field update 2 2 --description="Updated description!"
 
 
 
$ wp gf field get 2 2
 
 
 
{
 
"type":"text",
 
"id":2,
 
"label":"Name",
 
"adminLabel":"",
 
"isRequired":false,
 
"size":"medium",
 
"errorMessage":"",
 
"visibility":"visible",
 
"inputs":null,
 
"formId":2,
 
"description":"Updated description!",
 
"allowsPrepopulate":false,
 
"inputMask":false,
 
"inputMaskValue":"",
 
"inputMaskIsCustom":false,
 
"maxLength":"",
 
"inputType":"",
 
"labelPlacement":"",
 
"descriptionPlacement":"",
 
"subLabelPlacement":"",
 
"placeholder":"",
 
"cssClass":"field-33 field-left",
 
"inputName":"",
 
"noDuplicates":false,
 
"defaultValue":"",
 
"choices":"",
 
"conditionalLogic":"",
 
"productField":"",
 
"enablePasswordInput":"",
 
"multipleFiles":false,
 
"maxFiles":"",
 
"calculationFormula":"",
 
"calculationRounding":"",
 
"enableCalculation":"",
 
"disableQuantity":false,
 
"displayAllCategories":false,
 
"useRichTextEditor":false,
 
"pageNumber":1,
 
"fields":"",
 
"displayOnly":""
 
}
 
 
</pre>
 
</pre>
  
=== wp gf form ===
+
=== Disable or enable a form? ===
 
 
<pre>
 
$ wp help gf form
 
 
 
NAME
 
 
 
  wp gf form
 
 
 
DESCRIPTION
 
  
  Manage Gravity Forms.
+
I have the impression that you cannot disable or enable a form through a dedicated WP-CLI command.
  
SYNOPSIS
+
Example using SQL:
 
 
  wp gf form <command>
 
 
 
SUBCOMMANDS
 
 
 
  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.
 
  field            Manage Gravity Forms Form Fields.
 
  form_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.
 
  notification      Manage Gravity Forms Notifications.
 
  update            Updates a form.
 
</pre>
 
 
 
=== wp gf form create ===
 
=== wp gf form delete ===
 
  
 
<pre>
 
<pre>
$ wp help gf form delete
+
cd $site_path
 
+
sql="update wp_gf_form set is_active=0 where id=1"
NAME
+
wp db query "$sql"
 
 
  wp gf form delete
 
 
 
DESCRIPTION
 
 
 
  Deletes a form.
 
 
 
SYNOPSIS
 
 
 
  wp gf form delete <form-id>... [--force]
 
 
</pre>
 
</pre>
  
=== wp gf form edit ===
+
== Database-model ==
 
 
De helptekst is niet behulpzaam. Dit is de syntaxis:
 
 
 
<code>
 
wp gf form edit <form-id>
 
</code>
 
 
 
Vervolgens start een editor om een JSON-representatie van het formulier te bewerken.
 
 
 
=== wp gf form export ===
 
=== wp gf form field ===
 
=== wp gf form form_list ===
 
 
 
Zie <code>wp gf form list</code>. Dat is welliswaar een alias voor dit commando, maar ik vind 'm veel intuïtiever.
 
 
 
=== wp gf form get ===
 
 
 
<pre>
 
$ wp help gf form get
 
 
 
NAME
 
 
 
  wp gf form get
 
 
 
DESCRIPTION
 
 
 
  Returns the form JSON.
 
 
 
SYNOPSIS
 
 
 
  wp gf form get <form-id>
 
 
 
ALIAS
 
 
 
  get-form
 
</pre>
 
  
=== wp gf form list ===
+
=== Basic form settings - wp_gf_form ===
  
Dit is een alias voor <code>wp gf form form_list</code>. Ik vind deze naam veel logischer dan <code>form_list</code>
+
Basic form settings are stored in table <code>wp_gf_form</code>. Example:
  
 
<pre>
 
<pre>
$ wp help gf form list
+
$ select * from wp_gf_form;
 
 
NAME
 
 
 
  wp gf form form_list
 
 
 
DESCRIPTION
 
 
 
  Lists the forms with entry count and view counts.
 
 
 
SYNOPSIS
 
 
 
  wp gf form form_list [--active] [--trash] [--sort_column=<sort_column>] [--sort_dir=<sort_dir>] [--format=<format>]
 
 
 
ALIAS
 
  
   list
+
+----+----------------+---------------------+--------------+-----------+----------+
 +
| id | title          | date_created        | date_updated | is_active | is_trash |
 +
+----+----------------+---------------------+--------------+-----------+----------+
 +
|  1 | Contact form   | 2019-08-05 08:38:28 | NULL        |        0 |        0 |
 +
|  3 | Selection Tool | 2020-12-23 09:01:02 | NULL        |        1 |        0 |
 +
+----+----------------+---------------------+--------------+-----------+----------+
 
</pre>
 
</pre>
  
Voorbeeld:
+
Fields:
  
 
<pre>
 
<pre>
$ wp gf form form_list
+
* id            MEDIUMINT(10)  PK  NN  UN  AI
 
+
* title          VARCHAR(150)        NN
+----+---------------------------+---------------------+-----------+-------------+------------+
+
* date_created   DATETIME            NN
| id | title                    | date_created       | is_active | entry_count | view_count |
+
* data_updated  DATETIME                            Default: NULL
+----+---------------------------+---------------------+-----------+-------------+------------+
+
* is_active     TINYINT(10)          NN            Default: 1
| 1  | Contactformulier          | 2019-08-05 08:38:28 | 1        | 0          | 510        |
+
* is_trash      TINYINT(10)          NN            Default: 0
| 2  | Informatie formulier     | 2019-08-07 13:34:11 | 1         | 0          | 3956606    |
 
| 3  | Informatie formulier 2020 | 2020-12-23 09:01:02 | 1        | 0           | 493        |
 
+----+---------------------------+---------------------+-----------+-------------+------------+
 
 
</pre>
 
</pre>
  
=== wp gf form import ===
+
=== Form definitions - wp_gf_form_meta ===
=== wp gf form notification ===
 
=== wp gf form update ===
 
  
Ik weet niet waar dit commando voort dient. De helptekst is niet behulpzaam. Syntaxis:
+
Volledige definities van formulieren vind je in tabel <code>wp_gf_form_meta</code>. Ik denk dat het JSON-code is. Voordeel boven reguliere ''serialised data'': Het aantal bytes per veld is niet vastgelegd. Je kunt het dus veel gemakkelijker zelf bewerken. De verschillende kolommen:
  
<pre>
+
* <code>form_id</code>: Dezelfde formulier-ID als via de WP-CLI
wp gf form update <form-id> <--form-json | --file>
+
* <code>display_meta</code>: Lijkt dezelfde formulierdefinitie te zijn als die je krijgt via WP-CLI
</pre>
+
* <code>entries_grid_meta</code>: Onduidelijke serialised data - Heeft ogenschijnlijk gelukkig niets te maken met formulier zelf
 +
* <code>confirmations</code>: Complete definities van verzend-bevestigingen
 +
* <code>notifications</code>: Complete definities van de notificatie-emails die naar beheerders wordt gestuurd.
  
LET OP! Dit commando verwijdert het formulier, zonder vantevoren te waarschuwen:
+
== ReCAPTCHA add-on ==
  
<pre>
+
Google's ''ReCAPTCHA'' can be integrated into forms:
$ wp gf form update 1 --form-json=1
 
  
PHP Warning: Cannot use a scalar value as an array in /var/www/example.com/wp-content/plugins/gravityformscli/includes/class-gf-cli-form.php on line 554
+
* wp_admin » Forms » Settings » ReCAPTCHA
Warning: Cannot use a scalar value as an array in /var/www/example.com/wp-content/plugins/gravityformscli/includes/class-gf-cli-form.php on line 554
+
* https://www.google.com/recaptcha/about/
PHP Warning: Cannot use a scalar value as an array in /var/www/example.com/wp-content/plugins/gravityformscli/includes/class-gf-cli-form.php on line 558
+
* Using Google's reCAPTCHAs for Gravity Forms, requires the ''Gravity Forms reCAPTCHA Add-On'': https://www.gravityforms.com/add-ons/recaptcha/
Warning: Cannot use a scalar value as an array in /var/www/example.com/wp-content/plugins/gravityformscli/includes/class-gf-cli-form.php on line 558
+
* This is not the same as https://wordpress.org/plugins/gravity-forms-zero-spam/
PHP Warning: Cannot use a scalar value as an array in /var/www/example.com/wp-content/plugins/gravityforms/includes/api.php on line 222
+
* This add-on cannot be installed through <code>wp plugin install</code>: See <code>wp plugin search "gravity forms recaptcha" --per-page=100 | grep gravity</code>, https://wordpress.org/plugins/search/gravity+forms+recaptcha/ or try it yourself: <code>wp plugin install gravityformsrecaptcha</code>
Warning: Cannot use a scalar value as an array in /var/www/example.com/wp-content/plugins/gravityforms/includes/api.php on line 222
+
* Supposingly, it could be installed through <code>wp gf install gravityformsrecaptcha</code>. I suspect you need to always supply the key for Gravity Forms itself (not for the add-on, if there is such a thing). See [[Wp gf install (WP-CLI)]] for details.
Success: Form updated successfully
 
</pre>
 
  
=== wp gf install ===
+
After installation, the add-on does appear amongst plugins:
=== wp gf license ===
 
=== wp gf notification ===
 
 
 
Beheer notificaties per formulier.
 
  
 
<pre>
 
<pre>
$ wp help gf notification
+
$ wp plugin list | grep gravity
 
 
NAME
 
 
 
  wp gf notification
 
 
 
DESCRIPTION
 
 
 
  Manage Gravity Forms Notifications.
 
  
SYNOPSIS
+
gravityforms         active none 2.6.7
 
+
gravityformscli         active none 1.4
  wp gf notification <command>
+
gravityformsrecaptcha active none 1.1
 
 
SUBCOMMANDS
 
 
 
  create                Creates a new notification.
 
  delete                Deletes a notification.
 
  duplicate              Duplicates a notification.
 
  edit                  Launch system editor to edit the Form configuration.
 
  get                    Returns the notification JSON.
 
  notification_list      Lists the notifications form a form.
 
  update                Updates a Notification JSON.
 
 
</pre>
 
</pre>
  
==== wp gf notification create ====
+
== See also ==
==== wp gf notification delete ====
 
==== wp gf notification duplicate ====
 
==== wp gf notification edit ====
 
==== wp gf notification get ====
 
 
 
<pre>
 
$wp help gf notification get
 
 
 
NAME
 
 
 
  wp gf notification get
 
 
 
DESCRIPTION
 
 
 
  Returns the notification JSON.
 
 
 
SYNOPSIS
 
 
 
  wp gf notification get <form-id> <notification-id>
 
</pre>
 
 
 
''' Voorbeeld '''
 
 
 
<pre>
 
$ wp gf notification list
 
 
 
+---------------+-------------------+---------------------------------------+--------+
 
| id            | name              | subject                              | active |
 
+---------------+-------------------+---------------------------------------+--------+
 
| 5d47eb045c09b | Beheerdersmelding | Webformulier Example.nl {Naam:5}      | yes    |
 
+---------------+-------------------+---------------------------------------+--------+
 
 
 
$ wp gf notification get 1 5d47eb045c09b
 
 
 
{
 
  "isActive":true,"name":"Beheerdersmelding","service":"wordpress","event":"form_submission",
 
  "to":"info@example.nl","toType":"email","cc":"","bcc":"","subject":"Webformulier example.nl {Naam:5}",
 
  "message":"{all_fields}","from":"info@example.nl","fromName":"","replyTo":"{E-mailadres:2}",
 
  "routing":null,"conditionalLogic":null,"disableAutoformat":false,"enableAttachments":false,
 
  "id":"5d47eb045c09b"
 
}
 
</pre>
 
 
 
==== wp gf notification list ====
 
 
 
Verkrijg de lijst van notifications voor een gegeven formulier. <code>wp gf notification list</code> is de alias voor het eigenlijke commando. Ik vind deze alias veel handiger.
 
 
 
<pre>
 
$ wp help gf notification notification_list
 
 
 
NAME
 
 
 
  wp gf notification notification_list
 
 
 
DESCRIPTION
 
 
 
  Lists the notifications form a form.
 
 
 
SYNOPSIS
 
 
 
  wp gf notification notification_list <form-id> [--active] [--format=<format>] [--raw]
 
 
 
ALIAS
 
 
 
  list
 
</pre>
 
 
 
''' Voorbeeld '''
 
 
 
<pre>
 
wp gf notification list 1
 
 
 
+---------------+-------------------+---------------------------------------+--------+
 
| id            | name              | subject                              | active |
 
+---------------+-------------------+---------------------------------------+--------+
 
| 5d47eb045c09b | Beheerdersmelding | Webformulier example.nl {Naam:5}      | yes    |
 
+---------------+-------------------+---------------------------------------+--------+
 
</pre>
 
 
 
==== wp gf notification notification_list ====
 
 
 
Zie [[#wp gf notification list]]
 
 
 
==== wp gf notification update ====
 
 
 
=== wp gf setup ===
 
 
 
<pre>
 
$ wp help gf status
 
 
 
NAME
 
 
 
  wp gf setup
 
 
 
DESCRIPTION
 
 
 
  Runs the setup for Gravity Forms or a Gravity Forms official add-on.
 
 
 
SYNOPSIS
 
 
 
  wp gf setup [<slug>] [--force]
 
</pre>
 
 
 
=== wp gf tool ===
 
 
 
Diverse Gravity Forms tools:
 
 
 
<pre>
 
$ wp help gf tool
 
 
 
NAME
 
 
 
  wp gf tool
 
 
 
DESCRIPTION
 
 
 
  Misc Gravity Forms Tools.
 
 
 
SYNOPSIS
 
 
 
  wp gf tool <command>
 
 
 
SUBCOMMANDS
 
 
 
  clear_transients      Clears the Gravity Forms transients.
 
  empty-trash          Delete the trashed entries.
 
  system-report        Outputs the system report from the Forms > System Status page.
 
  verify-checksums      Verify Gravity Forms files against the checksums.
 
</pre>
 
 
 
=== wp gf update ===
 
 
 
Update de Gravtiy Forms-plugin. Voorbeeld:
 
 
 
<pre>
 
$ wp gf update
 
 
 
Downloading installation package from https://s3.amazonaws.com/gravityforms/releases/gravityforms_2.5.12.zip?AWSAccessKeyId...
 
Unpacking the package...
 
Installing the plugin...
 
Removing the old version of the plugin...
 
Plugin updated successfully.
 
Success: Installed 1 of 1 plugins.
 
 
 
Success: Database upgraded.
 
</pre>
 
 
 
=== wp gf version ===
 
 
 
Toon de versie van de Gravity Forms-plugin. Voorbeeld:
 
 
 
<pre>
 
$ wp gf version
 
 
 
2.5.12
 
</pre>
 
 
 
== Zie ook ==
 
 
 
* [[WP-CLI (commando's)]]
 
 
 
== Bronnen ==
 
  
* https://docs.gravityforms.com/category/add-ons-gravity-forms/ - Een indrukwekkende lijst van ''add-ons''
+
* [[Wp gf (WP-CLI) | wp gf]]
* https://docs.gravityforms.com/category/add-ons-gravity-forms/wp-cli-add-on/ - WP-CLI Add-on
+
* [[Wp gf install (WP-CLI)]]

Huidige versie van 31 okt 2022 om 14:43

Sinds 2020 is Gravity Forms m'n standaard formulieren-plugin, op advies van een specialist. Ik denk dat ik 'm ok vind. De belangrijkste dingen gaan heel soepel. Waarschijnlijk zijn het de nag-screens om maar de betaalde versie te kopen, waar ik het meeste moeite mee heb. En dat het de complete backend-interface van WordPress overneemt. Verder is-ie prima.

Dit artikel gaat tot op heden (okt. 2021) vrijwel uitsluitend over de WP-CLI-commando's om Gravity Forms en bijbehorende formulieren te beheren.

Licensering

Het is een betaalde plugin. Zonder licentie doet-ie nix.

  • Als ik sites kloon, is de gekloonde licentie ok - Itt. tot een andere plugin (naam vergeten) waarbij de licentie URL-afhankelijk was
  • Als ik alleen de plugin kopiëer en plak, is de licentie niet ok.

WP-CLI

Installation

Gravity Forms has quite a library of WP-CLI commands, but these need to be separately installed as a plugin:

wp plugin install gravityformscli --activate

Disable or enable a form?

I have the impression that you cannot disable or enable a form through a dedicated WP-CLI command.

Example using SQL:

cd $site_path
sql="update wp_gf_form set is_active=0 where id=1"
wp db query "$sql"

Database-model

Basic form settings - wp_gf_form

Basic form settings are stored in table wp_gf_form. Example:

$ select * from wp_gf_form;

+----+----------------+---------------------+--------------+-----------+----------+
| id | title          | date_created        | date_updated | is_active | is_trash |
+----+----------------+---------------------+--------------+-----------+----------+
|  1 | Contact form   | 2019-08-05 08:38:28 | NULL         |         0 |        0 |
|  3 | Selection Tool | 2020-12-23 09:01:02 | NULL         |         1 |        0 |
+----+----------------+---------------------+--------------+-----------+----------+

Fields:

* id             MEDIUMINT(10)   PK   NN   UN   AI
* title          VARCHAR(150)         NN
* date_created   DATETIME             NN
* data_updated   DATETIME                            Default: NULL
* is_active      TINYINT(10)          NN             Default: 1
* is_trash       TINYINT(10)          NN             Default: 0

Form definitions - wp_gf_form_meta

Volledige definities van formulieren vind je in tabel wp_gf_form_meta. Ik denk dat het JSON-code is. Voordeel boven reguliere serialised data: Het aantal bytes per veld is niet vastgelegd. Je kunt het dus veel gemakkelijker zelf bewerken. De verschillende kolommen:

  • form_id: Dezelfde formulier-ID als via de WP-CLI
  • display_meta: Lijkt dezelfde formulierdefinitie te zijn als die je krijgt via WP-CLI
  • entries_grid_meta: Onduidelijke serialised data - Heeft ogenschijnlijk gelukkig niets te maken met formulier zelf
  • confirmations: Complete definities van verzend-bevestigingen
  • notifications: Complete definities van de notificatie-emails die naar beheerders wordt gestuurd.

ReCAPTCHA add-on

Google's ReCAPTCHA can be integrated into forms:

After installation, the add-on does appear amongst plugins:

$ wp plugin list | grep gravity

gravityforms	        active	none	2.6.7
gravityformscli	        active	none	1.4
gravityformsrecaptcha	active	none	1.1

See also