title: Wordpress PHP array filter out subscribers
body: <p>I am working on a wordpress dashboard plugin that is designed to display a list of subscribers in the admin dashboard in a wordpress table.</p>
  
  <p>Everything works correctly apart from the fact that all registered users are displayed in the array when I need just subscribers.  I am creating the array with the following code..</p>
  
  <pre><code>function prepare_items() {
      $per_page = 5;
      $columns = $this-&gt;get_columns();        $hidden = array();        $sortable = $this-&gt;get_sortable_columns();
      $this-&gt;_column_headers = array($columns, $hidden, $sortable);
  
      global $wpdb;
      $data = $wpdb-&gt;get_results("SELECT * FROM $wpdb-&gt;users", ARRAY_A);  
      $i = 0;
  
      foreach($data as $single) {
      $meta = $wpdb-&gt;get_results(
      "SELECT meta_value
      FROM $wpdb-&gt;usermeta
      WHERE user_id = $single[ID]
      AND (meta_key = 'first_name' OR meta_key = 'last_name' OR meta_key = 'wp_user_level')
      ORDER BY meta_key",
      ARRAY_A
      );
  
      $data[$i]['first_name'] = $meta[0]['meta_value'];
      $data[$i]['last_name'] = $meta[1]['meta_value'];
      $data[$i]['wp_user_level'] = $meta[2]['meta_value'];
      $i++;
  }
  
      echo '&lt;pre&gt;'; 
      print_r($data2); 
      echo '&lt;/pre&gt;';
  </code></pre>
  
  <p>By using print_r I can see that the two tables wp_users and wp_usermeta are being correctly joined and all of the details I need are returned into the array.</p>
  
  <p>What I now need to do is use some kind of array_filter to only return entries that have a wp_user_level of 0 (subscriber).</p>
  
  <p>I have tried the following....</p>
  
  <pre><code>$data = array_filter($data, 'filter_subscribers');
  
  function filter_subscribers()
      {
          return $data2['wp_user_level'] == '0';
      }
  </code></pre>
  
  <p>But it is not working for me, can anyone suggest anything?</p>