• Hello,

    I’m using Gravity Forms Update Post to allow front-end editing of posts. If I request a form with a post ID that doesn’t exist (or that I don’t have permissions for), I get an empty form, which is what I would expect. But if I proceed to fill the form out anyway and hit the submit button, the form creates a new posting. I don’t want this form to be able to create new postings, just edit existing ones.

    I set the ‘entries’ parameter in the gravityforms-update-post.php file to false as shown below but that doesn’t seem to resolve the issue:

    class GFUpdatePost
    {
      public $options = array(
        'request_id' => 'gform_post_id'
        ,'post_status' => 'default'
        ,'capabilities' => array(
          'update' => 'author'
          ,'delete' => 'disable'
        )
        ,'entries' => false
      );

    I also tried this:

    class GFUpdatePost
    {
      public $options = array(
        'request_id' => 'gform_post_id'
        ,'post_status' => 'default'
        ,'capabilities' => array(
          'update' => 'author'
          ,'delete' => 'disable'
        )
        ,'entries' => 'false'
      );

    But it didn’t work either. I see a reference in the readme.txt about disabling entries but I don’t quite understand where to add the suggested filter. Any assistance would be much appreciated and if I can get this plugin working the way I need it to, I will promptly follow up with a donation to support the cause.

    Thanks,
    Tom

    http://wordpress.org/extend/plugins/gravity-forms-update-post/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter tomdaquino

    (@tomdaquino)

    My workaround to this issue is actually quite easy. I added a custom, hidden field to my original post form that adds a value to a custom taxonomy I call “validation”. The hidden field is populated with a default value of {user:user_login} (see the Default Value/Insert Variable option on the Advanced Tab for the field). So with every post created by a form, the user’s login is stored in a custom taxonomy field. I add the same custom, hidden field to my edit post form that pulls the user_login value up when you edit an entry that you have permissions for. If the edit post form does not pull up a value in the validation field, that means the user either did not enter a valid post ID or they entered a post ID they do not have permissions for.

    To make use of this validation so that the user cannot submit entries using the edit post form, I did the following:

    On the Advanced tab for the Form Settings, check the Enable Conditional Logic checkbox. Enter the condition:

    ‘Hide’ this form button ‘All’ of the following match:
    ‘validation’ is /blank/

    In the second row, ‘validation’ is my custom field that should be populated with the user’s login. By /blank/ I mean leave the condition field empty. If the validation field is empty when the user tries to edit a post, the submit button for the form will not be displayed.

    Also, I realized that the ‘entries’ option identified in my previous post is what allows the plugin to add a value to a field that was previously blank so most people will probably need that set as follows:

    class GFUpdatePost
    {
      public $options = array(
        'request_id' => 'gform_post_id'
        ,'post_status' => 'default'
        ,'capabilities' => array(
          'update' => 'author'
          ,'delete' => 'disable'
        )
        ,'entries' => true
      );
    Thread Starter tomdaquino

    (@tomdaquino)

    Ok, I’m a doof. The ‘entries’ => true/false parameter determines whether or not the edit form creates a new form entry that can be viewed under the Entries section in the Gravity Forms administration area.

    -Tom

    Thread Starter tomdaquino

    (@tomdaquino)

    I should also point out that my solution above is not the most secure option but it will work for the time being to keep the most casual of tinkerers from messing with my site. An ideal solution would be for some kind of logic in the plugin that disables the submit button if a post is not returned.

    Thanks,
    Tom

    Hi tomdaquino,

    Did you ever figure out how to make the plugin edit the entry instead of creating a new one? If I only want to edit one field, it doesn’t make sense to have a bunch of almost identical entries in the entries table. Could you post your solutions here if you have one please.

    Thanks,
    Yulia.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Gravity Forms – Update Post] Creates a new entry’ is closed to new replies.