User metabox display First & Last name

Support General User metabox display First & Last nameResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #24414
    eelgreelgr
    Participant

    Hi guys,

    Hope you're well.

    Just after a little advice; I have over 1000 users and they only have their firstname as the their display name so I'd like to display their first & last name - when I try the filter below they return blank; any ideas on this one?

    Thank you

    
    function wtw_user_filter($label, $field, $user) {
        return $user->first_name;
    }
    add_filter('rwmb_wtw-user_choice_label', 'wtw_user_filter', 10, 3);
    
    function contacts_user_restriction($meta_boxes) {
        $prefix = 'wtw-';
    
        $meta_boxes[] = array(
            'id' => 'user-restriction',
            'title' => esc_html__( 'Restrict content by user', 'wtw' ),
            'post_types' => array('contacts'),
            'context' => 'after_editor',
            'priority' => 'low',
            'autosave' => 'true',
            'fields' => array(
                array(
                    'id'   => $prefix . 'user',
                    'field_type'  => 'checkbox-list',
                    'type' => 'user',
                    'name' => esc_html__( 'Users', 'wtw' ),
                    'desc' => esc_html__( 'Select users who can view this contact.', 'wtw' ),
                ),
            ),
        );
    
        return $meta_boxes;
    }
    add_filter('rwmb_meta_boxes', 'contacts_user_restriction');
    #24415
    eelgreelgr
    Participant

    I've tried this also in the filter but returns blank too.

    return $user->first_name . ' ' . $user->last_name;

    Thank you

    #24445
    Long NguyenLong Nguyen
    Moderator

    Hi there,

    The developer team has pushed a new commit to cover this issue https://github.com/wpmetabox/meta-box/commit/8946df43ec02c5fccd5ace5c2aabbfbcb5efbf5f.

    It will be included in the next update, thank you.

    #24467
    eelgreelgr
    Participant

    Thank you, much appreciated 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.