Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 37 total)
  • Author
    Posts
  • justdoit123justdoit123
    Participant

    do 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;
    }
    in reply to: Show or Hide Fields Based On Role #30622
    justdoit123justdoit123
    Participant

    please update, I also need that functionality at the field level if that's possible.

    justdoit123justdoit123
    Participant

    my 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;
    }
    justdoit123justdoit123
    Participant

    After 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

    in reply to: PHP Code to create/update field value in Custom Table ? #30606
    justdoit123justdoit123
    Participant

    also 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;
    }
    in reply to: Cannot use shortcode to show user meta ??? #30600
    justdoit123justdoit123
    Participant

    also please help, how do i show sub field from a group filed for type: User meta ?

    in reply to: shortcode to show User meta type "Select Avanced" #30599
    justdoit123justdoit123
    Participant

    You 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 ??

    in reply to: shortcode to show User meta type "Select Avanced" #30597
    justdoit123justdoit123
    Participant

    Hi, 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

    justdoit123justdoit123
    Participant

    if 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.

    justdoit123justdoit123
    Participant

    Hi, it is only deleted in front, images are still there in Media : /wp-admin/upload.php

    justdoit123justdoit123
    Participant

    i 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.

    justdoit123justdoit123
    Participant

    hi, 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

    in reply to: Metabox default Login form ugly #30514
    justdoit123justdoit123
    Participant

    same here, not fix with css

    justdoit123justdoit123
    Participant

    exactly, if i add custom field ID : last_name

    metabox automatically change that Field Group Settings > Location to: Post type (not User)

    justdoit123justdoit123
    Participant

    i updated to Meta Box v5.4.6 and MB AIO 1.14.3 but same problem, it's still there. please fix

Viewing 15 posts - 16 through 30 (of 37 total)