Gravity Forms (WordPress-plugin)

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

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.

Installatie WP-CLI-add-on

Standaard ondersteunt Gravity Forms niet de WordPress Command Line Interface. Daar bestaat een gratis add-on voor. Die moet je apart installeren:

wp plugin install gravityformscli --activate

Installing Gravity Forms CLI Add-On (1.4)
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.

Activeren:

wp plugin install gravityformscli --activate

Database-model

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.

wp gf

$ wp help gf

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.

wp gf check_update

wp gf entry

$ 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.

wp gf entry delete

$ wp help gf entry delete

NAME

  wp gf entry delete

DESCRIPTION

  Deletes an entry.

SYNOPSIS

  wp gf entry delete <entry-id>... [--force]

Met de Boolean optie --force worden entries direct verwijderd, ipv. verplaatst te worden naar de prullenbak.

Voorbeelden:

# 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)

wp gf entry list

$ 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>]

--format

Mogelijke waardes:

  • table
  • csv
  • json
  • count
  • ids - Deze optie vind je niet snel terug in de documentatie.

-page_size

Standaard worden er 20 entries weergegeven. Met de parameter --page_size 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:

# 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

wp gf field

$ 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.

wp gf field create

wp gf field delete

wp gf field duplicate

wp gf field edit

wp gf field get

$ 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>

Voorbeeld

$ 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":""}

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.

$ 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>]

Voorbeeld

$ 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               |
+----+------------+-------------------------+

wp gf field update

$ 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>]

Voorbeeld (1)

$ 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      |
+----+------------+-------------------------+

Voorbeeld (2)

$ 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":""
}

wp gf form

$ wp help gf form

NAME

  wp gf form

DESCRIPTION

  Manage Gravity Forms.

SYNOPSIS

  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.

wp gf form create

wp gf form delete

$ wp help gf form delete

NAME

  wp gf form delete

DESCRIPTION

  Deletes a form.

SYNOPSIS

  wp gf form delete <form-id>... [--force]

wp gf form edit

De helptekst is niet behulpzaam. Dit is de syntaxis:

wp gf form edit <form-id>

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 wp gf form list. Dat is welliswaar een alias voor dit commando, maar ik vind 'm veel intuïtiever.

wp gf form get

$ 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

Voorbeeld

$ wp gf form get 1

{"title":"Contactformulier","description":"","labelPlacement":"top_label","descriptionPlacement":"below","button":{"type":"text","text":"Versturen","imageUrl":""},"fields":[{"type":"text","id":5,"label":"Name","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":1,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputMaskIsCustom":false,"maxLength":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","enablePasswordInput":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"pageNumber":1,"fields":"","displayOnly":""},{"type":"email","id":2,"label":"Email address","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":1,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputMaskIsCustom":false,"maxLength":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","emailConfirmEnabled":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false,"pageNumber":1,"fields":"","displayOnly":""},{"type":"phone","id":3,"label":"Phone number","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"phoneFormat":"international","formId":1,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputMaskIsCustom":false,"maxLength":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","form_id":"","productField":"","pageNumber":1,"fields":"","displayOnly":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"useRichTextEditor":false},{"type":"textarea","id":4,"label":"Questions or remarks?","adminLabel":"","isRequired":true,"size":"medium","errorMessage":"","visibility":"visible","inputs":null,"formId":1,"description":"","allowsPrepopulate":false,"inputMask":false,"inputMaskValue":"","inputMaskIsCustom":false,"maxLength":"","inputType":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","cssClass":"","inputName":"","noDuplicates":false,"defaultValue":"","choices":"","conditionalLogic":"","productField":"","form_id":"","useRichTextEditor":false,"pageNumber":1,"fields":"","displayOnly":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false}],"version":"2.4.20","id":1,"nextFieldId":6,"useCurrentUserAsAuthor":true,"postContentTemplateEnabled":false,"postTitleTemplateEnabled":false,"postTitleTemplate":"","postContentTemplate":"","lastPageButton":null,"pagination":null,"firstPageCssClass":null,"subLabelPlacement":"below","cssClass":"","enableHoneypot":true,"enableAnimation":false,"save":{"enabled":false,"button":{"type":"link","text":"Opslaan en later doorgaan"}},"limitEntries":false,"limitEntriesCount":"","limitEntriesPeriod":"","limitEntriesMessage":"","scheduleForm":false,"scheduleStart":"","scheduleStartHour":"","scheduleStartMinute":"","scheduleStartAmpm":"","scheduleEnd":"","scheduleEndHour":"","scheduleEndMinute":"","scheduleEndAmpm":"","schedulePendingMessage":"","scheduleMessage":"","requireLogin":false,"requireLoginMessage":"","is_active":"1","date_created":"2019-08-05 08:38:28","is_trash":"0","notifications":{"5d47eb045c09b":{"isActive":true,"name":"Beheerdersmelding","service":"wordpress","event":"form_submission","to":"info@example.nl","toType":"email","cc":"","bcc":"","subject":"Webform 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"}},"confirmations":{"5d47eb045cc57":{"id":"5d47eb045cc57","name":"Standaardbevestiging","isDefault":true,"type":"message","message":"Bedankt voor je bericht! We zullen binnenkort contact met je opnemen.","url":"","pageId":"","queryString":""}}}

wp gf form list

Dit is een alias voor wp gf form form_list. Ik vind deze naam veel handiger dan form_list

$ wp help gf form list

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

Voorbeeld:

$ wp gf form form_list

+----+---------------------------+---------------------+-----------+-------------+------------+
| id | title                     | date_created        | is_active | entry_count | view_count |
+----+---------------------------+---------------------+-----------+-------------+------------+
| 1  | Contactformulier          | 2019-08-05 08:38:28 | 1         | 0           | 510        |
| 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        |
+----+---------------------------+---------------------+-----------+-------------+------------+

wp gf form import

wp gf form notification

Dit commando is hetzelfde als → #wp gf notification

wp gf form update

Werk de complete definitie van een formulier bij.

LET OP: Het argument moet het complete object zijn. Anders raak je dingen kwijt.

$ wp help gf form update

NAME

  wp gf form update

DESCRIPTION

  Updates a form.

SYNOPSIS

  wp gf form update <form-id> [--form-json=<form-json>] [--file=<file>]

Voorbeeld - Zo dus niet!

$ 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
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
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
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
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
Warning: Cannot use a scalar value as an array in /var/www/example.com/wp-content/plugins/gravityforms/includes/api.php on line 222
Success: Form updated successfully

#... form is gone!

wp gf install

wp gf license

wp gf notification

Beheer notificaties per formulier.

$ wp help gf notification

NAME

  wp gf notification

DESCRIPTION

  Manage Gravity Forms Notifications.

SYNOPSIS

  wp gf notification <command>

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.

wp gf notification create

wp gf notification delete

wp gf notification duplicate

wp gf notification edit

Start de interactieve systeem-editor om de gespecificeerde notificatie te bewerken

$ wp help gf notification edit

NAME

  wp gf notification edit

DESCRIPTION

  Launch system editor to edit the Form configuration.

SYNOPSIS

  wp gf notification edit <form-id> <notification-id>

Voorbeeld

wp gf notification get 1 5d47eb045c09b

wp gf notification get

$wp help gf notification get

NAME

  wp gf notification get

DESCRIPTION

  Returns the notification JSON.

SYNOPSIS

  wp gf notification get <form-id> <notification-id>

Voorbeeld

$ 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"
}

wp gf notification list

Verkrijg de lijst van notifications voor een gegeven formulier. wp gf notification list is de alias voor het eigenlijke commando. Ik vind deze alias veel handiger.

$ 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

Voorbeeld

wp gf notification list 1

+---------------+-------------------+---------------------------------------+--------+
| id            | name              | subject                               | active |
+---------------+-------------------+---------------------------------------+--------+
| 5d47eb045c09b | Beheerdersmelding | Webformulier example.nl {Naam:5}      | yes    |
+---------------+-------------------+---------------------------------------+--------+

wp gf notification notification_list

Zie #wp gf notification list

wp gf notification update

Pas een bestaande notificatie aan.

LET OP: De waarde voor argument --notification-json moet het complete notification-object zijn. Je kunt dus niet maar één onderdeel vervangen.

$ wp help gf notification update

NAME

  wp gf notification update

DESCRIPTION

  Updates a Notification JSON.

SYNOPSIS

  wp gf notification update <form-id> [<notification-id>] --notification-json=<notification-json>

Voorbeeld: Fout!

Wat er gebeurt als je niet het complete notificatie-object meegeeft bij updaten:

$ wp gf notification get 1 5d47eb045c09b   # Formatting hieronder handmatig gedaan

{
   "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"}

$ wp gf notification update 1 5d47eb045c09b --notification-json='{"cc":"info@blub.nl"}'

$ wp gf notification get 1 5d47eb045c09b

{"cc":"info@blub.nl","id":"5d47eb045c09b"}   # Fuck. Rest is pleitte

Voorbeeld

Hierbij is de output van wp gf notification get 1 5d47eb045c09b gekopiëerd naar een script dat wordt gebruikt om de notificatie bij te werken:

not_var='{"isActive":true,"name":"Beheerdersmelding","service":"wordpress","event":"form_submission","to":"info@example.nl","toType":"email","cc":"","bcc":"","subject":"Webform 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"}'

wp gf notification update 1 5d47eb045c09b --notification-json="$not_var"

wp gf notification get 1 5d47eb045c09b
Het werkt!

Bronnen

wp gf setup

$ 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]

wp gf tool

Diverse Gravity Forms tools:

$ 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.

wp gf update

Update de Gravtiy Forms-plugin. Voorbeeld:

$ 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.

wp gf version

Toon de versie van de Gravity Forms-plugin. Voorbeeld:

$ wp gf version

2.5.12

Zie ook

Bronnen