Tagged: , , ,

Viewing 7 reply threads
  • Author
    Posts
    • #5847
      jivedig
      Participant

      Still moving along with 0.9.9.7 beta, it rocks.

      I have a metabox with a group field that includes a file field. I’m using a custom scope for the group and all the fields. Debugging the $fields values when testing all works well as long as the file upload field uses the Media Uploader. If basic: false, that field does not show any value at all during debugging. Very strange.

      Is this a bug, or a limitation in the basic uploader inside WP?

      Here’s the whole group:

      piklist('field', array(
          'type'        => 'group',
          'scope'       => 'connect_resource_to_lesson',
          'field'       => 'add_resource',
          'template'    => 'theme',
          'add_more'    => true,
          'label'       => __('Add New Resources', 'wampum'),
          'description' => __('Add resources now, or you can always attach resources later.', 'wampum'),
          'fields'      => array(
              array(
                  'type'    => 'text',
                  'scope'   => 'connect_resource_to_lesson',
                  'field'   => 'post_title',
                  'label'   => __('Title', 'wampum'),
                  'columns' => '12',
              ),
              array(
                  'type'    => 'editor',
                  'scope'   => 'connect_resource_to_lesson',
                  'field'   => 'post_content',
                  'label'   => __('Content', 'wampum'),
                  'columns' => '12',
              ),
              array(
                  'type'     => 'file',
                  'scope'    => 'connect_resource_to_lesson',
                  'field'    => 'resource_file',
                  'label'    => __('Upload File', 'wampum'),
                  'options' => array(
                      'basic' => true,
                  ),
              ),
          ),
      ));

      And here is my filter:

      add_action( 'piklist_save_field-connect_resource_to_lesson', 'jivedig_debut_this_scope', 10, 1 );
      function jivedig_debut_this_scope($fields) {
      	// My debugger from DesktopServer
      	trace($fields);
      }
    • #5852
      Steve
      Keymaster

      @jivedig– Why are you using a custom scope? They are not supported yet.

    • #5858
      jivedig
      Participant

      Wait, they’re not supported?

      I was just using it as a callback to process the field data myself. Is that scary? I’m building a big plugin now on top of Piklist. I need to manually process the data from the fields and save to the db in my own way. I don’t want some of the fields to save anything, just allow me to grab the values via piklist_save_field. Is there another way to do this?

      Hopefully I’m just missing something. Custom scope/processing was one of the big things I liked about Piklist. Can you clear this up for me?

      FWIW, I was chatting with Jason Adams via email and he was the one that recommended using a custom scope to accomplish this. I just assumed it was a thing after that.

    • #5859
      Jason
      Keymaster

      @jivedig Hi! Since you’re handling this yourself with a custom scope and are using the non-WordPress standard uploader, check the $_FILES superglobal to see if your file is showing up there.

    • #5860
      jivedig
      Participant

      @jason Thanks. I’ll give it a try. Now i’m nervous that my whole project is based on custom scope. How far into dangerous territory am I (re Piklist)?

    • #5861
      Jason
      Keymaster

      @jivedig: Sorry, you’re just fine with the custom scope. Steve was thinking of a feature that was discussed for the future to support custom tables via scope. But custom scopes for manual processing have been supported for quite a while. You’re not in dangerous territory. 🙂

    • #5862
      jivedig
      Participant

      @jason: PHEW! I’m deep in this plugin, and LOVING Piklist. So happy I happened to sit at your table at WordCamp US 🙂
      Without custom scope Piklist would lose a lot of its power IMO.
      Thanks!

    • #5863
      Jason
      Keymaster

      @jivedig: Definitely! Hopefully we’ll see you again next year!

      It’s definitely a powerful feature. But, to be fair, there’s a lot to Piklist. That’s just a small piece. 😉

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