Viewing 14 replies - 1 through 14 (of 14 total)
  • I’m looking for the answer to this as well. Not by using a shortcode but by passing the post id directly from the page template. I have not found the proper solution yet. Any luck on your end?

    I don’t have a short code, but I did add a function to interface with the plugin so that I could add the post id through php instead of with a GET variable. It would be used to create a short code.

    This is my update:

    Overview | Download

    This is still being tested by me, but it is working for what I need so far. I needed to remove GET variable dependancy and to be able to update files. The file part isn’t very graceful, but it is working.

    hi jcow,

    Thanks for your contribution.

    I’ve downloaded your update and replaced the original with yours.

    and added the code given below to my functions.php.

    add_filter( 'gform_update_post_settings', 'custom_gform_update_post_settings' );
    
    function custom_gform_update_post_settings( $settings )
    {
        $settings['request_id'] = 'edit_id';
        return $settings;
    }

    But I cannot get it setup, what would I need to add/change/remove in order to get this to work?

    The setting you used isn’t very important.

    If you want to have a form edit a post, you need to pass that post’s id to the form using one of two methods. Either add the post id to the url using the GET variable set up by this plugin “gform_post_id” or with the updated version of the plugin, you can pass the post id through a function instead.

    Example 1, url for the current page:
    https://example.com/path/to/edit/page/?gform_post_id=24

    Example 2, in your page template:

    gravityforms_update_post('setup_form', 24);
    gravity_form(1);

    The code you added to functions.php will simply change gform_post_id to edit_id.

    So after adding that to your functiions.php, you would use:
    https://example.com/path/to/edit/page/?edit_id=24
    instead of:
    https://example.com/path/to/edit/page/?gform_post_id=24

    Using

    gravityforms_update_post('setup_form', 24);
    gravity_form(1);

    (24 = the post’s id you want to update, 1 = the form’s id)
    a third user will not be able to change the desired post id by adding /?gform_post_id=1 to the url (in order he wants to edit the post with id=1). That’s a good point and big improvement by jcow

    btw jcow,

    I don’t want to be rude or impolite but I do not know if you noticed the issue on https://bitbucket.org/jupitercow/gravity-forms-update-post/issue/1/previously-uploaded-file that I added.

    I don’t get how to..: […]It also keeps the file from being removed from the field on save when nothing new was added.[…]

    Could you specify the feature’s setup?

    It has been a while since I looked at that, I need a few minutes to review it. Hopefully that will happen to tomorrow, but feel free to ping me, if you don’t hear anything.

    That’d be great to see! Thank you

    Hi jcow thanks for getting back to me! and thanks for the input wpoo.

    Excuse my ignorance but will I have to setup 2 separate forms one for the post submission and another for editing the post or can I setup one form that will be able to do both functions?

    Thank you

    This is what I want to do:

    – Users must submit my form (from their dashboard) which will in turn submit a post
    – The user must be able to edit the same post using the same form on the dashboard

    If multiple users submit the same form from their dashboard, will the post ID be unique for each post?

    From the code:

    gravityforms_update_post('setup_form', 24);
    gravity_form(1);

    Where 24 is the Post ID and (1) is the from ID. It seems that this is a fixed post ID that would link to one post only, or am I mistaken, will it support multiple posts from different users?

    Am I able to achieve this using this plugin? Or will custom work be needed?

    When I use the function call “gravityforms_update_post(‘setup_form’, $post_id);” to pass the post id, I receive an Error 500.

    The debug log says: PHP Fatal error: Call to undefined function gravityforms_update_post() .

    Any idea why this function can’t be found??

    I am using wordpress 3.6.

    cynarad, have you managed to get yours setup?

    No, I still get the message “PHP Fatal error: Call to undefined function gravityforms_update_post()”

    There was definitely a bug before. The previous was version was a really quick fix to get it working for me, since the plugin hasn’t been updated in a long time and appears to be orphaned.

    In the past couple weeks, I rewrote the whole thing. See the new write up for a better explanation:
    https://bitbucket.org/jupitercow/gravity-forms-update-post

    Let me know what issues you come upon in the issues system on bitbucket, since this plugin is really completely different than the plugin here, there i no reason to try and support it here currently.

    I will work on getting these updates into the WordPress plugin repository in the future.

    The new version also DOES have a shortcode. It… isn’t ideal. You have to add an extra short code in front of the gravity form shortcode, but it is a shortcode…

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: Gravity Forms – Update Post] pass post ID within shortcode?’ is closed to new replies.