Forum Replies Created
-
AuthorPosts
-
February 7, 2022 at 7:14 PM in reply to: How to bind to plupload events for file Upload field #33706
Long Nguyen
ModeratorHi Malak,
Thanks for your feedback.
I will inform the development team to fix this issue in future updates. For now, I think you can use the JS code to check the class
rwmb-media-list, if it has the child classrwmb-file, then enable the submit button. If not, just disable the submit button.
Screenshot https://monosnap.com/file/VTKLaiip6oeCd3n29Wl2IH38rHvH6gLong Nguyen
ModeratorHi,
Thank you for your feedback.
I've escalated this issue to the development team to fix it in the next update.
Long Nguyen
ModeratorHi Kirb,
When displaying the post data and custom fields, you can store the post data in the HTML attributes then use that data with JavaScript (popup). Get more details on this documentation https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
and refer to this topic https://stackoverflow.com/questions/37859318/post-data-attributes-on-click-using-ajax
February 7, 2022 at 6:32 PM in reply to: Ajax interfering with using get_the_ID() inside rwmb_frontend_after_process #33703Long Nguyen
ModeratorHi Graceson,
For the post submitted, you can use the passing variable
$post_idto get the post ID. For the current post that shows the frontend form, you can use the WP functionget_queried_object_id()to get the post ID. For example:add_action( 'rwmb_frontend_after_process', function( $config, $post_id ) { $data = [ 'field_1' => 'value 1', 'field_2' => 'value 2', 'field 3' => ['one', 'two', 'three'], ]; // or \MetaBox\CustomTable\API::update( get_queried_object_id(), 'my-custom-table', $data ); \MetaBox\CustomTable\API::update( $post_id, 'my-custom-table', $data ); }, 10, 2 );Long Nguyen
ModeratorHi Paul,
Thanks for sharing your solution. Very appreciated.
Long Nguyen
ModeratorThanks for sharing your solution.
Long Nguyen
ModeratorHi,
You can use the date filter in View, like this
{{ mb.get_post_meta( post.ID, 'date_created', true ) | date( 'Y-m-d' ) }}Refer to this documentation https://twig.symfony.com/doc/3.x/filters/date.html
February 6, 2022 at 11:14 PM in reply to: ✅How to display attachemnts upload /modification date? #33685Long Nguyen
ModeratorHi,
You need to pass the file ID to the function
get_the_date()to get the date of the file. If not, it will take the current post ID to get the date. The code should be:{% for item in user.file_upload %} {{ mb.get_the_date( 'd.m.Y', item.ID ) }} {% endfor %}February 6, 2022 at 11:04 PM in reply to: ✅Relationship box won't show up below costom fields #33684Long Nguyen
ModeratorHi,
No, it is not possible to change the meta box location (order) of user data with MB AIO. You can drag and drop the meta box relationship to re-order it and save the post to update the user data.
Tip: use Classic Editor for drag and drop meta boxes easier https://wordpress.org/plugins/classic-editor/
Long Nguyen
ModeratorThanks for the additional information.
So the issue does not come from Meta Box itself. You can wait for the new update from Yoast to fix the issue.
February 6, 2022 at 10:50 PM in reply to: Unable to display frontend submission form in Oxygen Builder #33681Long Nguyen
ModeratorHi Anthony,
Can you please share the frontend shortcodes that you are using on your site? Some screenshots would be appreciated.
Refer to the documentation https://docs.metabox.io/extensions/mb-frontend-submission/
and this topic https://support.metabox.io/topic/cannot-send-post-another-time-dashboard-post-id/Long Nguyen
ModeratorHi,
Ok, I got your case. You can use the WordPress function
wp_get_post_parent_id()to get the post parent of the current post. Then use the post parent (ID) in the field query args. For example:function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $post_id = null; if ( isset( $_GET['post'] ) ) { $post_id = intval( $_GET['post'] ); } elseif ( isset( $_POST['post_ID'] ) ) { $post_id = intval( $_POST['post_ID'] ); } // Get post parent of the current post $post_parent = wp_get_post_parent_id( $post_id ); $meta_boxes[] = [ ... 'fields' => [ [ 'name' => __( 'Controller', 'your-text-domain' ), 'id' => $prefix . 'controller', 'type' => 'post', 'post_type' => ['controller'], 'field_type' => 'select_advanced', 'query_args' => [ 'orderby' => 'post_title', 'order' => 'ASC', 'post_parent' => $post_parent, // Show child posts 'post__not_in' => [ $post_id ] // Exclude current post ], 'tab' => 'monitor_details', ], ], ]; return $meta_boxes; }Read more on the documentation https://developer.wordpress.org/reference/functions/wp_get_post_parent_id/
February 6, 2022 at 10:15 PM in reply to: ✅Problem with conditional logic used in a clonable group field #33679Long Nguyen
ModeratorHi Mike,
The conditional logic works with the name of the input box. The subfield in a cloneable group will have the input name
groupID[index][subfieldID], for examplegroup_hlso8r8au9[0][select_e8av28xu5t4] group_hlso8r8au9[1][select_e8av28xu5t4]You need to put the input name exactly to make the conditional logic works.
'visible' => [ 'when' => [['group_hlso8r8au9[0][select_e8av28xu5t4]', '=', 'yes']], 'relation' => 'or', ],But it will apply to all cloneable groups, so in general, it is not recommended to use the conditional logic with a cloneable field or group.
February 6, 2022 at 9:59 PM in reply to: How to display Price & Quantity below Woo-Product title? #33678Long Nguyen
ModeratorHi Sascha,
You can follow this article to get product info https://www.businessbloomer.com/woocommerce-easily-get-product-info-title-sku-desc-product-object/
and display the price and stock quantity with the custom fields code.February 6, 2022 at 9:47 PM in reply to: ✅Append a Related Posts title to the title of created Post. #33677Long Nguyen
ModeratorHi,
Each relationship meta box has an ID:
{$relationship_id}_relationships_fromand{$relationship_id}_relationships_to. You can use this meta box ID with the actionrwmb_{$meta_box_id}_after_save_post. For example:add_action( 'rwmb_clients-and-equipment_relationships_from_after_save_post', 'update_post_title'); function update_post_title( $post_id ) { // Get the relation object ID via the key {$relationship_id}_from or {$relationship_id}_to $related_title_1 = get_the_title( $_POST['clients-and-equipment_from'][0] ); // Get the current post title $current_post_title = $_POST['post_title'] // Prepare update post $my_post = array( 'ID' => $post_id, 'post_title' => $current_post_title . ' ' . $related_title_1, ); wp_update_post( $my_post ); } -
AuthorPosts