Forum Replies Created
-
AuthorPosts
-
Long Nguyen
ModeratorHi,
It's not possible to show/hide specific Meta Box fields in the JSON data of REST API. I think you can restrict access to WP REST API within this code
add_filter( 'rest_authentication_errors', function( $result ) { // If a previous authentication check was applied, // pass that result along without modification. if ( true === $result || is_wp_error( $result ) ) { return $result; } // No authentication has been performed yet. // Return an error if user is not logged in. if ( ! is_user_logged_in() ) { return new WP_Error( 'rest_not_logged_in', __( 'You are not currently logged in.' ), array( 'status' => 401 ) ); } // Our custom authentication check should have no effect // on logged-in requests return $result; });Refer to this topic https://stackoverflow.com/questions/32082922/restrict-access-to-wordpress-rest-api
Long Nguyen
ModeratorHi Will,
WooCommerce templates are created by functions and the View template cannot override the template of WooCommerce. You can follow this topic from WooCommerce support to know how to customize the order page https://wordpress.org/support/topic/customizing-woocommerce-view-order-template/
or this article to use WooCommerce hooks https://rudrastyh.com/woocommerce/add-info-view-order-thank-you-pages.html
and show field value by using the helper functionrwmb_meta()https://docs.metabox.io/displaying-fields/#using-codeAugust 9, 2021 at 9:22 AM in reply to: user data / frontend-editing / compare fields + existing email #30026Long Nguyen
ModeratorHi,
Can you please share some screenshots and the URL of the page that has the email field? I will help you to check this issue.
Or you can use the jQuery Validation to validate the email field https://docs.metabox.io/validation/#validation-with-jquery-validation-plugin
If you use the default field
user_email, it has the default validation of WordPress to check if the email exists. If you want to check the email value of another custom field, please try to use theremotesetting of Validation. Refer to this topic https://support.metabox.io/topic/remote-validation-example/Long Nguyen
ModeratorHi,
Just to clarify that Meta Box only helps you to create custom fields on the backend to allow users to input data and support showing the raw data on the frontend without displaying it in a layout or styling it.
So you need to have a basic knowledge about coding to use the code in the article or contact the builder support to ask for help in this case.
Long Nguyen
ModeratorHi,
In the Insert Field area, you can click on the tab User and select the user meta field. Screenshot https://imgur.com/WuEqL4K
The tab
userin the View support getting the meta of logged-in user. If you want to get the user meta from a user, please use the helper functionrwmb_meta(). Get more details on this documentation
https://docs.metabox.io/extensions/mb-user-meta/#getting-field-value
https://docs.metabox.io/extensions/mb-views/#running-php-functionsFor example
{% set user_image = mb.rwmb_meta( 'user_field_ID', {object_type: 'user'}, 1 ) %} <img src="{{user_image.url}}" >Long Nguyen
ModeratorHi,
The helper shortcode only shows the raw URL on the frontend without styling in a button like that. Did you add another button and hovering it?
To show the URL field value in a button, you need to assign it to the attribute
hrefof the<a>tag to make it clickable. Just like<a href="<?php echo rwmb_meta( 'field_url_id' ) ?>">Button Link</a>August 7, 2021 at 9:12 PM in reply to: ✅Relationship WP_Query for Oxygen Builder [Repeater] component #30010Long Nguyen
ModeratorHi,
I'm not sure how the query of Oxygen Builder works but you can check the query param to get the relationship here https://docs.metabox.io/extensions/mb-relationships/#posts
Long Nguyen
ModeratorHi,
I've tried to reproduce the issue on my end but do not see any error like that. Screen record https://www.loom.com/share/4dd0881196c7487a93e71c5ca3afed3c
The code that creates meta box and custom fields:
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $meta_boxes[] = [ 'title' => __( 'Post Meta', 'your-text-domain' ), 'id' => 'post-meta', 'fields' => [ [ 'name' => __( 'Retailer Group', 'your-text-domain' ), 'id' => $prefix . 'retailer_group', 'type' => 'group', 'clone' => true, 'fields' => [ [ 'name' => __( 'Retailer CPT', 'your-text-domain' ), 'id' => $prefix . 'retailer_cpt', 'type' => 'post', 'post_type' => ['page'], 'field_type' => 'select_advanced', ], [ 'name' => __( 'Retailer Price', 'your-text-domain' ), 'id' => $prefix . 'retailer_price', 'type' => 'text', ], ], ], ], ]; return $meta_boxes; }The code in the View:
{% for clone in post.retailer_group | sort((a, b) => a.retailer_price <=> b.retailer_price) %} {{ clone.retailer_cpt.title }} ID: {{ clone.retailer_cpt.ID }} price: {{ clone.retailer_price }} <br> {% endfor %}Long Nguyen
ModeratorHi,
You can use the meta box action
rwmb_{$field_id}_after_save_fieldthen update another field value with the function update_post_meta().Get more details on the documentation https://docs.metabox.io/actions/#rwmb_after_save_field
Refer to these topics https://support.metabox.io/topic/use-rwmb_frontend_after_save_post/
https://support.metabox.io/topic/using-custom-meta-fields-to-create-cpt-title/Long Nguyen
ModeratorHi,
The link to the documentation above has the guildline to create a custom query to show the list of favorite posts. You can do the following:
$post_ids = get_user_meta( $user_id, 'mbfp_posts', true ); $query = new WP_Query( [ 'post_type' => 'post', 'post__in' => $post_ids, ] ); // Do something with $query.August 7, 2021 at 9:22 AM in reply to: ✅Use shortcode to display custom taxonomy metadata with taxonomy #29987Long Nguyen
ModeratorHi Darren,
You can refer to this documentation to create a custom shortcode to show anything that you want https://docs.metabox.io/extensions/meta-box-group/#outputing-group-with-page-builders
Long Nguyen
ModeratorHi,
The feature Ajax Search is only supported for the field
select_advancedto select the value. We do not handle any search function on the front end. If you want to create a search form on the frontend by using Ajax or Rest API, this article might help you to do that https://sabrinazeidan.com/wp-rest-api-search-with-autocomplete-with-vanilla-js/Long Nguyen
ModeratorHi,
Thank you for your feedback.
How did you update the FontAwesome? Through the code or use a third-party plugin? Can you please share some screenshots of the issue?
And follow the Debugging Information step to check if there is an error message https://support.metabox.io/topic/how-to-create-a-new-topic/
Long Nguyen
ModeratorHi Jon,
I think it is different from Meta Box's aim. MB helps you to create custom fields on the backend and show the field value on the frontend. Your case is to allow the user to create a note from the frontend and save the value to the database that sounds like the comments system of WordPress.
Some LMS plugins like LearnDash or LearnPress might help you or you need to create your own code to do this.
Long Nguyen
ModeratorHi,
MB Views gets the field info and other data like posts, terms ... via WP REST API. So I think there is a problem with the REST API on your site. Please follow the Debugging Information step here to troubleshoot this issue https://support.metabox.io/topic/how-to-create-a-new-topic/
Let me know how it goes.
-
AuthorPosts