Forum Replies Created
-
AuthorPosts
-
September 8, 2021 at 8:52 AM in reply to: ✅Private Hidden Admin Note for User meta - only Admin, Manager can see per User #30658
justdoit123
Participantdo i need to add_filter or add_action with this function ?? thanks
function your_prefix_function_name( $meta_boxes ) { $meta_boxes[] = [ 'title' => __( 'User Meta', 'your-text-domain' ), 'id' => 'user-meta', 'type' => 'user', 'include' => [ 'relation' => 'OR', 'user_role' => ['editor'], ], 'fields' => [ ... ], ]; return $meta_boxes; }justdoit123
Participantplease update, I also need that functionality at the field level if that's possible.
September 6, 2021 at 4:02 PM in reply to: ✅Private Hidden Admin Note for User meta - only Admin, Manager can see per User #30621justdoit123
Participantmy php is limited. can you give me some more example ??
in this sample code below, i don't know how to assign this to specific metabox ID ??
thanks
add_filter( 'rwmb_meta_boxes', 'prefix_include_exclude_demo' ); function prefix_include_exclude_demo( $meta_boxes ) { $meta_boxes[] = array( 'title' => 'Include Meta Box', // Register this meta box for posts matched below conditions 'include' => array( // With all conditions below, use this logical operator to combine them. Default is 'OR'. Case insensitive. Optional. 'relation' => 'OR', // List of post IDs. Can be array or comma separated. Optional. 'ID' => array( 1, 2 ), // List of post parent IDs. Can be array or comma separated. Optional. 'parent' => array( 3, 4 ), // List of post slugs. Can be array or comma separated. Optional. 'slug' => array( 'contact', 'about' ), // List of page templates. Can be array or comma separated. Optional. 'template' => array( 'full-width.php', 'sidebar-page.php' ), // List of categories IDs or names or slugs. Can be array or comma separated. Optional. 'category' => array( 1, 'Blog', 'another' ), // List of tag IDs or names or slugs. Can be array or comma separated. Optional. 'tag' => array( 1, 'fun' ), // Custom taxonomy. Optional. // Format: 'taxonomy' => list of term IDs or names or slugs (can be array or comma separated) 'location' => array( 12, 'USA', 'europe' ), 'os' => array( 'Windows', 'mac-os' ), // List of parent categories IDs or names or slugs. Can be array or comma separated. Optional. 'parent_category' => 'Parent', // List of parent tag IDs or names or slugs. Can be array or comma separated. Optional. 'parent_tag' => 'Parent', // Parent custom taxonomy. Optional. // Format: 'parent_taxonomy' => list of term IDs or names or slugs (can be array or comma separated) 'parent_location' => array( 12, 'USA', 'europe' ), // Check if current post/page is a child page 'is_child' => true, // List of user roles. Can be array or comma separated. Optional. 'user_role' => 'administrator', // List of user IDs. Can be array or comma separated. Optional. 'user_id' => array( 1, 2 ), // Custom condition. Optional. // Format: 'custom' => 'callback_function' // The function will take 1 parameter which is the meta box itself 'custom' => 'manual_include', ), 'fields' => array( array( 'name' => 'Name', 'id' => 'name', 'type' => 'text', ), ), ); // 2nd meta box $meta_boxes[] = array( 'title' => 'Exclude Meta Box', // Don't register this meta box for posts matched below conditions 'exclude' => array( 'relation' => 'OR', 'ID' => array( 1, 2 ), 'parent' => array( 3, 4 ), 'slug' => array( 'contact', 'about' ), 'template' => array( 'full-width.php', 'left-sidebar.php' ), 'category' => array( 1, 'News' ), 'tag' => array( 1, 'fun' ), 'user_role' => array( 'administrator', 'editor' ), 'user_id' => array( 1, 2 ), 'location' => array( 12, 'USA', 'europe' ), 'os' => array( 'Windows', 'mac-os' ), 'is_child' => true, 'custom' => 'manual_exclude', ), 'fields' => array( array( 'name' => 'Job', 'id' => 'job', 'type' => 'text', ), ), ); return $meta_boxes; } function prefix_include_exclude_manual_include( $meta_box ) { if ( $meta_box['title'] == 'Include Meta Box' ) return true; return false; }September 6, 2021 at 11:30 AM in reply to: Custom upload folder > Not show image > Error: Cannot delete file #30615justdoit123
ParticipantAfter clicking on the X button to delete the image, you need to submit the changes to update the field value. >>> I know, i tried as you said, but it does not delete the image if i use Custom upload folder
September 5, 2021 at 10:50 PM in reply to: PHP Code to create/update field value in Custom Table ? #30606justdoit123
Participantalso how do i use short code and php code to show custom field value from custom table ??
i try this short code but it does not show value "name" for User ID = 1 :
[rwmb_meta id="name" object_id="1" storage_type="custom_table" table="wp_test"]here is my custom table
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Test', 'your-text-domain' ), 'id' => 'test', 'type' => 'user', 'storage_type' => 'custom_table', 'table' => 'wp_test', 'fields' => [ [ 'name' => __( 'Name', 'your-text-domain' ), 'id' => $prefix . 'name', 'type' => 'text', 'save_field' => 1, ], [ 'name' => __( 'Phone', 'your-text-domain' ), 'id' => $prefix . 'phone', 'type' => 'text', 'save_field' => 1, ], ], ]; return $meta_boxes; }justdoit123
Participantalso please help, how do i show sub field from a group filed for type: User meta ?
justdoit123
ParticipantYou need to pass the user ID through the attribute object_id to the shortcode to show the user meta, like this
> i want this shortcode automatically show value from current logined in user ??
justdoit123
ParticipantHi, my i create a custom field for User, ID this custom field: note11
Custom filed group id : group_customer_info
In this group i add a sub field text id: tm_name11
i try this code but it does not work:
[rwmb_meta id="note11" object_type="user" object_id="tm_name11"]
how do i use shortcode to show sub field user from Group field.
how do i use php code for that too ?
thanks
August 31, 2021 at 10:29 PM in reply to: ✅Error : "Invalid File" when delete image - Custom Field - User - Type : Image #30520justdoit123
Participantif i choose Image Advanced or Image upload, they will be deleted in Media too.
btw, can you add this feature to : Image Advanced or Image upload : real limit on choosing maximum images, i can still choose more than maximum and upload it to Media, Your limit only for frontend show up thumbnail.
August 31, 2021 at 10:27 PM in reply to: ✅Error : "Invalid File" when delete image - Custom Field - User - Type : Image #30519justdoit123
ParticipantHi, it is only deleted in front, images are still there in Media : /wp-admin/upload.php
August 31, 2021 at 9:01 PM in reply to: ✅Error : "Invalid File" when delete image - Custom Field - User - Type : Image #30516justdoit123
Participanti tested with admin role, editor, author role, same error, when i press X to delete that image.
it alert and not delete the image :: Error : Invalid File, cannot delete image after save.
August 31, 2021 at 8:55 PM in reply to: ✅Error : "Invalid File" when delete image - Custom Field - User - Type : Image #30515justdoit123
Participanthi, i tried in many hosting to VPS.
Please login here and see:
https://metaboxtest.tastewp.com/wp-admin/profile.php
(removed)this is just a test site, please go to : wp-admin/profile.php
and scroll down to meta Image. Click x to delete an image and an alert will appear
justdoit123
Participantsame here, not fix with css
August 29, 2021 at 9:16 PM in reply to: A bug if i add custom field for default meta : First name, last name, user_email #30483justdoit123
Participantexactly, if i add custom field ID : last_name
metabox automatically change that Field Group Settings > Location to: Post type (not User)
August 29, 2021 at 8:39 PM in reply to: The user profile page doesn't display Username & Password fields correctly #30480justdoit123
Participanti updated to Meta Box v5.4.6 and MB AIO 1.14.3 but same problem, it's still there. please fix
-
AuthorPosts