Forum Replies Created
-
AuthorPosts
-
ComSi
ParticipantThat's great ?
Will this be available via the Composer repo soon? Tried updating but there were no available yet.
ComSi
ParticipantSeems 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.
ComSi
ParticipantHi 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?
ComSi
ParticipantI'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 falseon 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.ComSi
ParticipantHi 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,
RonaldSeptember 27, 2019 at 2:02 PM in reply to: ✅Display tab based on the value of a field within another tab #16324ComSi
ParticipantYeah that's kind of what we were expecting, but wanted to make sure.
We'll try the custom_callback, thanks for that tip.ComSi
ParticipantHi 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 175When 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
ComSi
ParticipantHi Anh,
This fixed it for me.
Thank you for the quick support, much appreciated!Ronald
ComSi
ParticipantI 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!ComSi
ParticipantHi Anh Tran,
-
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? -
Okay. Did not get that from the documentation. Thanks for clearing that up.
ComSi
ParticipantThanks, just updated it through your suggestion. Work like a charm. Thanks!
ComSi
ParticipantHi Anh,
Thanks for the reply but it doesnt work. I tried what you said, and changed the
dev-trunkformeta-box(free version) to^4.15and runnedcomposer 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]?ComSi
ParticipantHello 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' );ComSi
ParticipantThanks 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.
-
-
AuthorPosts