Wp gf notification update (WP-CLI)
Versie door Jeroen Strompf (overleg | bijdragen) op 3 sep 2022 om 10:25 (Nieuwe pagina aangemaakt met 'Pas een bestaande notificatie aan. LET OP: De waarde voor argument <code>--notification-json</code> moet het ''complete'' notification-object zijn. Je kunt dus ni...')
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