- This topic has 3 replies, 2 voices, and was last updated 1 week, 4 days ago by .
-
Topic
-
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');
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.