Support Forum » User Profile

Forum Replies Created

Viewing 14 posts - 16 through 29 (of 29 total)
  • Author
    Posts
  • in reply to: How to disable submit when selecting an address? #16463
    ComSiComSi
    Participant

    That's great ?

    Will this be available via the Composer repo soon? Tried updating but there were no available yet.

    in reply to: PHP warning when using clone w/ date formatting #16462
    ComSiComSi
    Participant

    Seems like a compatibility issue where we have two plugins that both bundled your plugin(s) via Composer, as you documented this might cause problems. I guess we'll have to find a way to work around that.

    Thanks again for taking the time to check it on your end.

    in reply to: PHP warning when using clone w/ date formatting #16450
    ComSiComSi
    Participant

    Hi Ahn, I figured out what is causing the PHP error.
    When we add a field of the 'date' type, and add the 'save_format' option on that, it throws an error:

    
    array(
        'name'              => 'Example PHP DateTime error',
        'id'                => 'some_unique_id',
        'type'              => 'date',
        'clone'             => true,
        'clone_as_multiple' => true,
        'inline'            => false,
        'timestamp'         => false,
        'js_options'        => array(
            'dateFormat'        => $js_date_format,
            'showButtonPanel'   => false,
        ),
        'save_format'       => 'Y-m-d' // this throws the error
    )
    

    This results in the error:

    Warning: DateTime::createFromFormat() expects parameter 2 to be string, array given in /Users/ronald/Sites/metabox-debug.dev/wp-content/plugins/metabox-debug/vendor/meta-box/meta-box/inc/fields/datetime.php on line 175

    When you remove (or comment out) the 'save_format' option (documented here) the error disappears.

    Hopefully you replicate this too?

    in reply to: How to disable submit when selecting an address? #16429
    ComSiComSi
    Participant

    I'm basically having the same problem. When using the [enter] key I would expect to have the option selected but the complete page form is actually submitted.

    Tried setting a return false on the input field that is the parent of autocomplete pop-down, but apparently that is not the element where we can check on the keyup event for that pop-down.

    in reply to: PHP warning when using clone w/ date formatting #16325
    ComSiComSi
    Participant

    Hi Anh,

    Thank you for your quick replies, they are much appreciated.

    My colleague Erik will be unavailable for two weeks, and since I cannot replicate this either I'll ask him to work up a simple test case with some working code when he's back in.

    Thanks again,
    Ronald

    in reply to: Display tab based on the value of a field within another tab #16324
    ComSiComSi
    Participant

    Yeah that's kind of what we were expecting, but wanted to make sure.
    We'll try the custom_callback, thanks for that tip.

    in reply to: PHP warning when using clone w/ date formatting #16289
    ComSiComSi
    Participant

    Hi Anh,

    We still getting an warning when we are using a cloneable datetime fields with a save_format.

    Warning: DateTime::createFromFormat() expects parameter 2 to be string, array given in .....\vendor\meta-box\meta-box\inc\fields\datetime.php on line 175

    When i change $date = DateTime::createFromFormat( $field['save_format'], $meta ); into $date = is_array($meta) ? false : DateTime::createFromFormat( $field['save_format'], $meta ); it works. Can you investigate if it's a solid solution, or provide another one?

    Erik-Jan

    in reply to: PHP warning when using clone w/ date formatting #16092
    ComSiComSi
    Participant

    Hi Anh,

    This fixed it for me.
    Thank you for the quick support, much appreciated!

    Ronald

    in reply to: Limitations of select_tree (field_type) #14769
    ComSiComSi
    Participant

    I stand corrected, that was the case.

    I was in the understanding that ordering of metaboxes was done in a cookie, not in the usermeta table.
    This solved my problem, thanks!

    in reply to: Limitations of select_tree (field_type) #14748
    ComSiComSi
    Participant

    Hi Anh Tran,

    1. Meta box, I think. Not entirely sure what you mean here?
      In my sample code it is set in the root level of the array, not in the nested "fields" key. Did you mean that?
      When I change out the type=taxonomy for type=text for example, it jumps over to the side. Is this because the title/parent/child are too wide for the sidebar maybe?

    2. Okay. Did not get that from the documentation. Thanks for clearing that up.

    in reply to: Updating MetaBox with extensions through composer #11606
    ComSiComSi
    Participant

    Thanks, just updated it through your suggestion. Work like a charm. Thanks!

    in reply to: Updating MetaBox with extensions through composer #11599
    ComSiComSi
    Participant

    Hi Anh,

    Thanks for the reply but it doesnt work. I tried what you said, and changed the dev-trunk for meta-box (free version) to ^4.15 and runned composer update.

    My require element look like this:

    
    "require": {
        "wpackagist-plugin/meta-box": "^4.15",
        "meta-box/meta-box-conditional-logic": "dev-master",
        "meta-box/meta-box-group": "dev-master"
    }
    

    Again the same error:

    
    C:\{MY_PATH}>composer update
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Package operations: 0 installs, 1 update, 0 removals
      - Updating wpackagist-plugin/meta-box (dev-trunk => 4.19.10):  Checking out tags/4.19.10
        Update failed (Package could not be downloaded,
    'svn' is not recognized as an internal or external command,
    operable program or batch file.
    )
        Would you like to try reinstalling the package instead [yes]?
    
    in reply to: How to set a upload directory for file_upload #9492
    ComSiComSi
    Participant

    Hello Anh,

    We did it with some action checks in the post. While the ajax-request runs it also runs the 'upload_dir' function. So we did it like the code underneed.

    function change_upload_dir( $param ) {
        
        // Ajax request for deleting an uploaded file from MetaBox
        if( isset($_POST['action']) && $_POST['action'] == 'delete-post' ) {
            // Check if CPT is: Downloads
        }
    
        // Ajax request for the list of uploaded files from MetaBox
        elseif( isset($_POST['action']) && $_POST['action'] == 'query-attachments' ) {
            // Check if CPT is: Downloads
        }
    
        // Other actions
        else {
            //Check if post is cpt:bestanden
            if( isset($post->post_type) && $post->post_type == 'Downloads' ) {
            } 
        }
        
    }
    add_filter( 'upload_dir', 'change_upload_dir' );
    
    in reply to: How to set a upload directory for file_upload #9478
    ComSiComSi
    Participant

    Thanks Anh, that example works. A bit too limited for our needs though.
    It gets a lot more complicated since we're trying to do that only for a specific custom post type, not complete WordPress.

    We basically created a CPT "Downloads" and each post has a file uploaded to it through the file_upload metabox field. This file needs to be uploaded to /wp-content/uploads/secure/ and not /wp-content/uploads/[year]/[month]/ like the rest of time images and files that can be publicly available.

    The files uploaded to this /wp-content/uploads/secure/ directory are being denied through .htaccess so that only PHP can access them, not the browser directly.

    <Files *>
      Deny from all
    </Files>

    In theory.., not that hard. Especially since the file has a correct GUID in the database directly from the start. But after uploading a file and reloading the custom post type page, the above example no longer works without jumping through a whole lot of hoops.
    I think we might have found a way by hooking into all the ajax hooks that are being fired for uploading, viewing and deleting a file to this custom post.

    I'm not sure if we can show you a complete example of what we ended up with because it's so many hooks tied together. We'll let you know.

Viewing 14 posts - 16 through 29 (of 29 total)