Support

Account

Home Forums Front-end Issues I can’t get userdata to show properly from a User Object select field Reply To: I can’t get userdata to show properly from a User Object select field

  • When changing the ACF for this user object to return the user array, I get all the data for this “manager’. But I can’t parse out just the display_name. I’ve tried this code with no luck

    $args = array('orderby' => 'display_name',);
    $users = get_users($args);
    foreach($users as $user){		
    	
    	$userID = 'user_'.$user->ID ;
    	
    	echo '<li>';
    		echo '<b style="font-size:14px;">' . $user->data->display_name . ' x' . $user->emp_office_ext . '</b><br/>';
    		echo '<em style="font-size:12px;white-space: nowrap; ">' . get_field('position',$userID) . '</em>';
    		
    		if (!empty(the_field('manager',$userID))){
    							
    			$manager = get_field('manager',$userID);
    										
    			echo $manager->display_name;
    		}
    	echo '</li>';
    }