Gravity Forms, confirmation page and shortcode

Gravity Forms
15 August, 2020 07:02:07
chenovazquez
Topics: 1
Messages: 3
Dear all,

Thank you for the great plugin.

I have one doubt which may be easy to solve, but which is driving me crazy.

I have created a form with Gravity Form, which fills a PDF. When I include the shortcodes in the confirmation message provided by Gravity Forms, everything works great and the user is able to view or download the PDF which he has completed. However, when I select in Gravity Form a confirmation page (instead of a confirmation message), the shortcodes are not working (the links are not appearing).

I guess I am doing something wrong in the query string section. I attach a picture of my current configuration. Could you kindly confirm: (i) whether it is possible to allow the user to view or download his PDF entry in a page (instead of in a confirmation message) and (ii) which additional information should I include in the query string in order to make this work?

Thank you very much.

Best reagrds,
15 August, 2020 11:19:19
E2Pdf
Support
Topics: 7
Messages: 3163
Hi,

Unfortunately yes, shortcode will not work in this case as E2Pdf doesn't know for which entry it must be generated download link as Gravity Forms doesn't send this information by default, however it must be possible to complete the task with some PHP hooks. Our dev team will review your question on Monday / Tuesday and we hope will get solution for you.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
16 August, 2020 00:11:18
chenovazquez
Topics: 1
Messages: 3
Thank you very much for checking this. Looking forward to hearing from you.
17 August, 2020 02:39:30
E2Pdf
Support
Topics: 7
Messages: 3163
Hi,

Here is an example how to complete the current task:

1. It was created "Hidden" field under forms with name "Entry Key". There will be saved Unique Entry Key generated upon submission so we can identify entry and avoid users view other entries by changing Entry ID inside URL (screenshot 1).

2. It was added redirect with query parameters to bypass "Entry Key" (screenshot 2)

3. It's need to add custom shortcode: [e2pdf-gravity-entry-download] to the page to which user will be redirected with "Entry Key" parameter. (screenshot 3)

4. Copy code to your functions.php: https://codeshare.io/2E7JlO.

It contains:

- generation of Entry Key and updating entry on form submission, keep attention on action name (gform_pre_submission_6), 6 must be changed to your form id and $field_id must be changed to your hidden field id which will contain Entry Key.

- custom shortcode (e2pdf-gravity-entry-download) function, which will parse entry_key and convert it to entry_id with render of "e2pdf-download" shortcode. There must be changed $form_id, $field_id and $template_id,

Let us know please if you will face any issues with implementation.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
17 August, 2020 08:33:52
chenovazquez
Topics: 1
Messages: 3
Thank you very much, this works perfectly. Much appreciated. Thank you for the great support.