2

I am using native Gravity Forms to create posts.

I am using Gravity Forms + Custom Post Types to handle creating custom post type posts. This works great.

Its been about 3 years since i've had to create/update posts in a wordpress project using Gravity Forms. Back then it was super easy to update posts using Gravity Forms: Post Updates

It was so simple, just add update to the end of the Gravity Form shortcode...

[gravityform id="2" title="false" description="false" ajax="true" update]

...and voila, the form would get all the current post data/custom fields and automatically map each Gravity Form post field and pre-renders each input with the current post data. When you save the form, it would update the current post instead of creating a new one. Job done.

Anyway, Gravity Forms: Post Updates no longer works because its not been updated in 4 years and upon installation in Wordpress 5.2.1, it throws a fatal error.

Plugin could not be activated because it triggered a fatal error.

Fatal error: Cannot use lexical variable $value as a parameter name in ../wp-content/plugins/gravity-forms-post-updates/gravityforms-update-post.php on line 1021

Thats spooned it so what is an alternative solution?

I don't want to have to custom code each field with a custom function using gform_pre_render and gform_after_submission filters/actions.

Please any ideas for Gravity Forms: Post Updates alternative would be awesome thanks.

1 Answer 1

1

I found a solution to fix this issue on the plugin Github page.

It's not ideal, but a work around until Gravity Forms makes this a core feature.

https://github.com/jupitercow/gravity-forms-post-updates

To fix the error and allow the plugin to be installed, you have to change...

row 1021 in file gravityforms-update-post.php

from (version 1.2.17)...

add_filter( 'gform_field_value_' . $field['inputName'], function($value) use($value) { return $value; } );

to...

add_filter( 'gform_field_value_' . $field['inputName'], function($v) use($value) { return $v; } );


Thanks to bagendahl. So far i've not stumbled across any issues.

See the original Github issue thread here.

Hope this saves someone some time.

3
  • Is this still working? Have done the fix to get the plugin up and running, but the shortcode with "update" at the end does not populate the fields for me. Are you still using this plugin without any issue?
    – Fredrik
    Jul 25, 2020 at 22:45
  • 1
    Allright. Had a small breaktrough but in to the next wall quite soon. The fields have to be "post fields", apprently. I have built my forms with normal fields and then used the Post Creation settings to match these to different post meta. Its also a custom post type. This plugin does not seam to handle this setup, my fields are empty.. Are you using only post fields for you setup or do you have any knowledge if this does plugin support standard fields used with the Post Creation settings?
    – Fredrik
    Jul 25, 2020 at 22:59
  • This plugin only works with the older method, like you said, of using post fields. The super flexible Post Creation plugin is a completely different world... I wish GF would just support editing...
    – Jake
    Feb 17, 2021 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.