Q:

PHP & Wordpress: How do I display a list of all users who have completed a custom user meta field, omitting those where the field is left empty? 

On a Wordpress site I'm developing, I have created a fcustom user meta field (matrix-diagnosis) where people can add additional information. 
I'm trying to display a list of all users who have completed this field (and their response), but would like to omit those who have not completed the field. 
After a LOT of Googling, the closest I've gotten is this bit of code...
<ul class="unstyled">

<? php
  //these are the arguments for the get_users function below
  $args  = array(
     'fields' => 'all_with_meta',
     'meta_query' => array('key' => 'matrix-diagnosis')
  );

  //get_users calls WP_User_Query and returns an array of matching users
  $users = get_users($args);

  //leaving an array of $users sorted by the value of meta 'points'
  foreach ($users as $user) : ? >

     <li>
        <h3><?php the_author_meta( 'first_name', $user->id ); ? > <? php the_author_meta( 'last_name', $user->id ); ? ></h3>
        <p><?php the_author_meta( 'matrix-diagnosis', $user->id ); ? ></p>
     </li>

<? php endforeach; /* end for each function */ ? >

</ul>

This actually will query the database and display a list of all users and their responses, but if someone has not completed the field, displays just their name.  How do I scrub the list of people for whom that field has no value? 
I have a hunch the secret lies not in using an array, but in using the $wpdp tag, which I have had no luck with to date. 
Thanks in advance! 

A:

I think you can change the_author_meta( 'matrix-diagnosis', $user->id ); to $matrix_check = get_the_author_meta( 'matrix-diagnosis', $user->id, true ); and on your foreach statment check if empty like:
foreach ($users as $user) : ? >
<? php $matrix_check = get_the_author_meta( 'matrix-diagnosis', $user->id, true );
if ($matrix_check ! = "") {? >
     <li>
        <h3><?php the_author_meta( 'first_name', $user->id ); ? > <? php the_author_meta( 'last_name', $user->id ); ? ></h3>
        <p><?php the_author_meta( 'matrix-diagnosis', $user->id ); ? ></p>
     </li>

Note: Not tested, some tags not closed

