Update the entry when the using Download link

Gravity Forms
5 March, 2024 12:52:10
Stephen
Topics: 5
Messages: 7
Hi

I would like to update a field from "Not Printed" to "Previously Printed" when a user clicks on the download link . I am using GravityKit / Gravityview to display the entries and using a custom field to display the Download link.

I have a field called Print Status (Field ID 22) and I would like to update the wording of the Print Status Field to "Previously Printed" once the user clicks on the download link.

You have previously helped me do this but in that case I was using GP Entry Blocks. That seems to work but if I use Gravityview then the same snippet you provided does not update the wording of the field.

You previously provided this snippet :

add_action('e2pdf_controller_frontend_e2pdf_download_success', function ($uid, $params) {
if (!empty($params['template_id']) && $params['template_id'] == '15') {
if (!empty($params['dataset'])) {
GFAPI::update_entry_field($params['dataset'], '22', 'Previously Printed');
}
}
}, 10, 2);

Your help with this would be greatly appreciated.

Kind Regards
5 March, 2024 13:20:17
E2Pdf
Support
Topics: 7
Messages: 3345
Hello,

The code seems correct. Are sure that you are using the correct Template ID: 15?

What type of field do you use with Gravity Forms that must be updated? Is it a "Hidden" field or a simple "Text" field?

Do you use a simple [e2pdf-download] shortcode?
We would really appreciate your feedback at WordPress.org!
5 March, 2024 22:47:24
Stephen
Topics: 5
Messages: 7
Hi

I do believe I was using the correct Template ID (15). The field I am using is a dropdown.

[gravityforms action="conditional" merge_tag="{:22}" condition="is" value="Not Printed"]
[e2pdf-download id="15" dataset="{entry_id}" button-title="PRINT"]
[/gravityforms]

HOWEVER I do believe I have resolved the issue. It looks like it is related to the Caching features that GravityView uses to speed up their plugin. I went through their documentation and they have a filter to disable this caching feature.

add_filter('gravityview_use_cache', '__return_false');

Once I added this to my site the problem seems to be resolved.

Thank you for being willing to assist.

Kind Regards
Stephen Wall