Hi,
I created a custom post type with a user field. I extended the user field with a few extra fields by using the hook acf/fields/user/result (see code below). This works perfectly, but when I want to search in the dropdown it only works for the user name and not the added data. How should I manage that I can search on everything that is added to the dropdown?
//add company to acf user dropdown
function change_user_acf_result( $result, $user, $field, $post_id ) {
$result = $user->user_login;
if( $user->first_name ) {
$result = $user->first_name;
if( $user->last_name ) {
$result .= ' ' . $user->last_name;
}
}
um_fetch_user( $user->ID );
$company = um_user('installateur-company');
$lang = um_user('installateur-lang');
if($company) $result = $company." - ".$result;
if($lang) $result .= ' - ' . $lang;
return $result;
}
add_filter( 'acf/fields/user/result', 'change_user_acf_result', 5, 4 );