Dette innstikket er ikkje testa med dei tre siste utgåvene av WordPress. Det kan henda det ikkje blir vedlikehalde lenger, og kan ha problem med nyare versjonar av WordPress.

Forms: 3rd-Party Inject Results

Skildring

Allows you to include results from a Forms 3rdparty Integration submission by flattening the response and inserting it within the original contact form submission.

Installasjon

  1. Unzip, upload plugin folder to your plugins directory (/wp-content/plugins/)
  2. Make sure Forms 3rdparty Integration is installed and settings have been saved at least once.
  3. Activate plugin
  4. In the newly available section «Inject Results» in the «3rdparty services» admin, enter the flattened service response keys like Response/Body/SomeKey, one per line.
    a. If the response is JSON or XML it will scan the elements/keys according to the segments you’ve entered; in the above example it will look for { Response: { Body: { SomeKey: "foobar" } } } and include «foobar» with the submission.
  5. Some contact form plugins only allow injecting/overwriting an existing field (e.g. Gravity Forms). In these cases you can provide an «alias» to overwrite with Response/Body/SomeKey=the_alias, where the_alias is the contact form field to override.
    a. With Gravity Forms, fields should be overwritten using aliases like input_X where «X» is the field’s id.

Vanlege spm.

Installation Instructions
  1. Unzip, upload plugin folder to your plugins directory (/wp-content/plugins/)
  2. Make sure Forms 3rdparty Integration is installed and settings have been saved at least once.
  3. Activate plugin
  4. In the newly available section «Inject Results» in the «3rdparty services» admin, enter the flattened service response keys like Response/Body/SomeKey, one per line.
    a. If the response is JSON or XML it will scan the elements/keys according to the segments you’ve entered; in the above example it will look for { Response: { Body: { SomeKey: "foobar" } } } and include «foobar» with the submission.
  5. Some contact form plugins only allow injecting/overwriting an existing field (e.g. Gravity Forms). In these cases you can provide an «alias» to overwrite with Response/Body/SomeKey=the_alias, where the_alias is the contact form field to override.
    a. With Gravity Forms, fields should be overwritten using aliases like input_X where «X» is the field’s id.
How does it add the response values?

Using the provided endpoint example test-response.php will «echo» back your 3rdparty submission with keys altered to be prefixed with «req-«. So if your submission was

{ name: { first: "FirstName", last: "LastName" }, email: "myemail@email.com", etc: "foobar" }

The response would be flattened and prefixed to

{ "req-name\first": "FirstName", "req-name\last": "LastName", "req-email": "myemail@email.com", "req-etc": "foobar" }

You would then inject req-name\first or req-etc.

To ensure that you’re dynamically overwriting existing form submission values, you can use the test response endpoint with value prefix/suffix like test-response.php?prefix=1234&suffix=4321, which would change the flattened response to

    { "req-name\first": "1234FirstName4321", "req-name\last": "1234LastName4321", "req-email": "1234myemail@email.com4321", "req-etc": "1234foobar4321" }
What are some XML/JSON examples?

XML

[env:Envelope/env:Body/ns1:Response/ns1:Resultstatus] => foo
[env:Envelope/env:Body/ns1:Response/ns1:Result] => bar
[env:Envelope/env:Body/ns1:Response/ns1:Description] => baz

JSON

[Body/Response/ResultStatus] => foo
[Body/Response/Result] => bar
[Body/Response/Description] => baz

Note that XML responses will include the namespace prefixes. You may then reference them by the entire key shown above.

It doesn’t work right…

Drop an issue at https://github.com/zaus/forms-3rdparty-inject-results

Bidragsytarar og utviklarar

“Forms: 3rd-Party Inject Results” is open source software. The following people have contributed to this plugin.

Contributors

Endringslogg

0.2

  • confirmed with GF at least

0.1

IT HAS BEGUN