Viewing 8 reply threads
  • Author
    Posts
    • #9056
      naurojr
      Member

      Hi PK Forum,
      I’ve been trying to get a front-end form working for non-logged users but for some reason, it doesn’t.
      I’ve stripped the form to the bare minimum and it still, it only saves data when the user is logged.

      Here is the code I’m using. Any suggestions?

      <?php
      /*
      Title: Add New Client
      Method: post
      Message: Client Saved
      Logged in: false
      */

      // Where to save this form
      piklist(‘field’, array(
      ‘type’ => ‘hidden’
      ,’scope’ => ‘post’
      ,’field’ => ‘post_type’
      ,’value’ => ‘client’
      ));

      piklist(‘field’, array(
      ‘type’ => ‘text’
      ,’scope’=>’post’
      ,’columns’ => 12
      ,’field’ => ‘post_title’
      ,’label’ => ‘Name’
      ,’description’ => “”
      ,’attributes’ => array(
      ‘class’ => ‘regular-text’
      ,’placeholder’ => ‘Enter client\’s Full Name.’
      )
      ,’required’ => true
      ));

      piklist(‘field’, array(
      ‘type’ => ‘hidden’
      ,’scope’ => ‘post’
      ,’field’ => ‘post_status’
      ,’value’ => ‘publish’
      ));

      piklist(‘field’, array(
      ‘type’ => ‘submit’
      ,’field’ => ‘submit’
      ,’value’ => ‘Submit’
      ));
      ?>

    • #9057
      Steve
      Keymaster

      @naurojr– We’re looking into this.

    • #9058
      naurojr
      Member

      Thank you Steve. Do you have any estimate on when that would be working? No pressure, just want to plan accordingly.

      By the way, great work on Piklist improvements.

      Best regards,

      Nauro Rezende Jr.

    • #9059
      Steve
      Keymaster

      So happy you like the improvements!

      A quick way for you to fix it:
      1) Create a custom user role with no capabilities. You can do it with code, or a plugin like “Members
      2) Then assign that role to each field.

      For example, if you create a role called “submitter”, then your fields will look like this:

      piklist(‘field’, array(
        'type' => 'hidden'
        ,'scope' => 'post'
        ,'field' => 'post_type'
        ,'value' => 'client'
        ,'role' => 'submitter'
      ));

      You need to add 'role' => 'submitter' to each field, except submit.

    • #9060
      Steve
      Keymaster

      I put in a Pull Request for this. Would appreciate if you could test my code:
      https://github.com/piklist/piklist/pull/104/files

      It should work with the code you posted above. No need to add the role parameter.

    • #9061
      naurojr
      Member

      It works like a charm 🙂 I will make some additional tests and let you know if something breaks, but it looks like everything will work. Thank you very much for your help.

    • #9065
      Steve
      Keymaster

      @lrtrln– We don’t have a release date yet, but we’re pushing to get it down before Gutenberg is released.

    • #9066
      naurojr
      Member

      Hi Steve,

      Regarding saving the data, everything is work perfectly. I only found a minor bug.
      When you have required fields, that are not filled and hit submit.
      The page shows the success message and the error messages all at the same time.

      See screenshot attached.

      Attachments:
      You must be logged in to view attached files.
    • #9068
      Steve
      Keymaster

      Thanks! We’ll look into this.

Viewing 8 reply threads
  • You must be logged in to reply to this topic.